Scripts.com - Get the best scripts NOW!
HotScripts.com - Over 10 web rings.
more links...
Ron Paul 2008 - Hope for America
    
Index    News    Downloads    E-Mail me    Forum  
    

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.

see also :  ftp-browse.php, upload.php, almost-ajax-upload.php
database-file-upload-download.php, show-zip-files.php, show-zip-files.asp