PHP: Upload Files to the Server June 20th, 2009
With PHP, it is simple to upload any file to your server.
uploader.php
$target_path = “uploads/”;
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo “The file “. basename( $_FILES['uploadedfile']['name']). †has been uploadedâ€;
} else{
echo “There was an error uploading the file, please try again!â€;
}?>
The form used to apply this uploading:
I suggest implementing a password (php) protection on this page to ensure noone other than the administrator can upload files. Missuse of uploading can surpass a server’s space and cause fines or bans of site owners. So be careful.
courtesy http://www.tech-recipes.com/rx/3112/php-upload-files-to-the-server-2/
