| |
UPLOAD.PHP
Allows users to upload files to your website.
I wrote this script to illustrate the basic
operations required for file uploading, I don't
recommend it be used as is, because people may
upload programs and scripts. If you want only
images to be uploaded, you may want to modify
the extension of any file that doesn't have
isn't a jpg, png, or gif.
For the function to work, your sumbitting document would need to have the following HTML code:
<form enctype="multipart/form-data" method="post">
<input type="file" name="arbitrary_input_name" />
</form>
The server side call to upload from this form would look like this:
<? upload_file("arbitrary_input_name", $path); ?>
For those getting permission errors when running this script, it may be because
PHP, that usually runs as the user nobody, does not have permission to write to
your directories. Chmodding the upload folder with 0777 is one solution
(not a very attractive one), another would be to Chown it to user_name:nobody.
|
|
|
|