note 93959 added to function.file
| From: | cwbeck at gmail dot com | Date: | Thu, 08 Oct 2009 14:11:50 +0000 |
| Subject: | note 93959 added to function.file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161509@lists.php.net to get a copy of this message | ||
<?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!
----
Server IP: 87.124.86.47
Probable Submitter: 93.97.22.130 (proxied: 93.97.22.130)
----
Manual Page -- http://www.php.net/manual/en/function.file.php
Edit -- https://master.php.net/note/edit/93959
Del: integrated -- https://master.php.net/note/delete/93959/integrated
Del: useless -- https://master.php.net/note/delete/93959/useless
Del: bad code -- https://master.php.net/note/delete/93959/bad+code
Del: spam -- https://master.php.net/note/delete/93959/spam
Del: non-english -- https://master.php.net/note/delete/93959/non-english
Del: in docs -- https://master.php.net/note/delete/93959/in+docs
Del: other reasons-- https://master.php.net/note/delete/93959
Reject -- https://master.php.net/note/reject/93959
Search -- https://master.php.net/manage/user-notes.php