
File Uploader
If you have an impatient personality and don't like to keep going to your control panel or FTP, searching through masses of folders to find the right one to upload a file into? You can code an uploader exactly like that, whether it's to serve your impatience or your visitors.
First, make two files: upload.php, uploader.php, and uploads_list.php. Then, if you haven't already, create a directory with the name 'uploads' (or any other name you prefer, but make sure you change the PHP later on.)
Let's start off easy with HTML. Open upload.php. This will be the page you'll go to to upload all of your files. Paste this code inside the file:
Save and open uploader.php. This part is the most important, so read carefully and don't make any mistakes. Copy the code below into the file. Make sure you replace ALL occurrences of 'YOURSITE.COM' with your website domain. If it's a sub-domain, remove the 'www' in the URL. If your target directory is named 'uploads', don't change anything. If it's not named 'uploads', replace all occurrences of 'uploads' with the name of your target directory. Don't edit anything else between <?php and ?>.
This step is optional but recommended. Open uploads_list.php. To make sure that visitors (or you) don't overwrite a file, a list with all the files in the directory will be listed. To do this, copy the script below into uploads_list.php. Again, change 'uploads' to your target directory name.
If you're deciding to skip this step, go back to upload.php and take out the following section of code:
<b>Important!</b> <p> Before uploading, please make sure the file you're uploading does not have the same name as another file on this list: </p> <ul> <?php include("/home/www/YOURSITE.COM/uploads_list.php"); ?> </ul>
Hope this tutorial was useful, because it took me a lot of frustrating days to get the script and tutorial done. Hopefully life can be one step closer to easy now that you have a personal uploader. (;




