note 60775 added to features.file-upload
| From: | ujkulkarni at gmail dot com | Date: | Mon, 16 Jan 2006 09:32:52 +0000 |
| Subject: | note 60775 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101914@lists.php.net to get a copy of this message | ||
image upload code given below
dosnt work in firefox
<!-- The data encoding type, enctype, MUST be specified as below -->
<html>
<head>
<title>
</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php"
method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
</body>
</html>
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = './data/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60775
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60775&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60775&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60775&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60775&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60775&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60775&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60775&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60775&report=yes
Search -- http://master.php.net/manage/user-notes.php