note 93959 deleted from function.file by danbrown
| From: | danbrown@php.net | Date: | Thu, 08 Oct 2009 14:31:19 +0000 |
| Subject: | note 93959 deleted from function.file by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161517@lists.php.net to get a copy of this message | ||
Note Submitter: cwbeck at gmail dot com
----
<?php
$uploadPath = "uploaded_files/"; // = {path-to-webroot}/www/uploaded_files/
/* For more information about the uploaded files, do:
print_r($_FILES); // Here you can put in security measures to check content-type and file-size!
*/
$uploadPath = $uploadPath.basename($_FILES['ufile']['name']);
if(move_uploaded_file($_FILES['ufile']['tmp_name'], $uploadPath)){
echo 'Check your uploaded_files directory, there should be a file there!';
} else{
echo 'Oooops, something has gone wrong and your file was not uploaded!';
}
?>
This code provided by:
http://www.openzu.com/Code_Samples/PHP/File_Upload.html
It provides the basic for a trivial file upload. However this will still need quite a few security
considerations!
Hope this helps!