note 70856 added to function.move-uploaded-file
| From: | Nibinaear at osu1 dot php dot net | Date: | Wed, 01 Nov 2006 10:49:52 +0000 |
| Subject: | note 70856 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119283@lists.php.net to get a copy of this message | ||
If you want to change the filename used by the user then use this code (static name). This example
uploads a pdf magazine to a website and always overwrites the file that is there. Use if you are
dealing with a small number of files or people who know what they're doing!
<?php
if(!empty($_FILES["magfile"]))
{
$uploaddir = $_SERVER['DOCUMENT_ROOT']."/dainsider/magazines/";
$uploaddir.="magazine.pdf";
//Copy the file to some permanent location
if(move_uploaded_file($_FILES["magfile"]["tmp_name"], $uploaddir))
{
echo "Magazine Updated!";
}
else
{
echo "There was a problem when uploding the new file, please contact
".$admin_email." about this.";
print_r($_FILES);
}
}
?>
----
Server IP: 83.138.144.80
Probable Submitter: 82.71.67.46
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- https://master.php.net/note/edit/70856
Del: integrated -- https://master.php.net/note/delete/70856/integrated
Del: useless -- https://master.php.net/note/delete/70856/useless
Del: bad code -- https://master.php.net/note/delete/70856/bad+code
Del: spam -- https://master.php.net/note/delete/70856/spam
Del: non-english -- https://master.php.net/note/delete/70856/non-english
Del: in docs -- https://master.php.net/note/delete/70856/in+docs
Del: other reasons-- https://master.php.net/note/delete/70856
Reject -- https://master.php.net/note/reject/70856
Search -- https://master.php.net/manage/user-notes.php