note 63702 deleted from function.move-uploaded-file by bjori
| From: | bjori@php.net | Date: | Tue, 28 Mar 2006 19:37:03 +0000 |
| Subject: | note 63702 deleted from function.move-uploaded-file by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106875@lists.php.net to get a copy of this message | ||
Note Submitter: PaBi3
Reason: bad code
----
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";
}
?>