note 63702 added to function.move-uploaded-file
| From: | PaBi3 at osu1 dot php dot net | Date: | Tue, 28 Mar 2006 19:24:11 +0000 |
| Subject: | note 63702 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106869@lists.php.net to get a copy of this message | ||
If you don't know how to upload images (or files) when the safe_mod is On (function
move_uploaded_file is restricted) you can use following code
<?php
if(isset($_POST['upload']))
{
$handle = fopen('image.jpg','w'); // save image as "image.jpg"
fwrite($handle,file_get_contents($_FILES['image']['tmp_name']));
fclose($handle);
echo 'Ok';
} else {
echo "<form action='".$_SERVER['PHP_SELF']."'
method='post' enctype='multipart/form-data'>\n";
echo "<fieldset>\n";
echo "<input name='image' type='file' /><br />\n";
echo "<input name='MAX_FILE_SIZE' type='hidden'
value='65536' />\n";
echo "<input name='upload' type='submit' />\n";
echo "</fieldset>\n";
echo "</form>\n";
}
?>
----
Server IP: 195.46.80.5
Probable Submitter: 85.135.163.114
----
X-Spam-Status: No, hits=4.2 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_40_50,HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- http://master.php.net/note/edit/63702
Del: integrated -- http://master.php.net/note/delete/63702/integrated
Del: useless -- http://master.php.net/note/delete/63702/useless
Del: bad code -- http://master.php.net/note/delete/63702/bad+code
Del: spam -- http://master.php.net/note/delete/63702/spam
Del: non-english -- http://master.php.net/note/delete/63702/non-english
Del: in docs -- http://master.php.net/note/delete/63702/in+docs
Del: other reasons-- http://master.php.net/note/delete/63702
Reject -- http://master.php.net/note/reject/63702
Search -- http://master.php.net/manage/user-notes.php