note 70119 added to features.file-upload
| From: | avijit6399 at yahoo dot com | Date: | Wed, 04 Oct 2006 06:44:01 +0000 |
| Subject: | note 70119 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118011@lists.php.net to get a copy of this message | ||
Can any one tell if this code is right or wrong?
<?php
// Define file size limit
$limit_size=50000;
//set where you want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "phptest/".$HTTP_POST_FILES['ufile']['name'];
if($ufile !=none)
{
// Store upload file size in $file_size
$file_size=$HTTP_POST_FILES['ufile']['size'];
if($file_size >= $limit_size){
echo "Your file size is over limit<BR>";
echo "Your file size = ".$file_size;
echo " K";
echo "<BR>File size limit = 50000 k";
}
else {
//copy file to where you want to store file
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>";
echo "<img src=\"$path\" width=\"150\"
height=\"150\">";
}
else
{
echo "Copy Error";
}
}
}
?>
----
Server IP: 66.163.161.117
Probable Submitter: 203.197.96.5 (proxied: 1.1 JUPITER)
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.php
Edit -- https://master.php.net/note/edit/70119
Del: integrated -- https://master.php.net/note/delete/70119/integrated
Del: useless -- https://master.php.net/note/delete/70119/useless
Del: bad code -- https://master.php.net/note/delete/70119/bad+code
Del: spam -- https://master.php.net/note/delete/70119/spam
Del: non-english -- https://master.php.net/note/delete/70119/non-english
Del: in docs -- https://master.php.net/note/delete/70119/in+docs
Del: other reasons-- https://master.php.net/note/delete/70119
Reject -- https://master.php.net/note/reject/70119
Search -- https://master.php.net/manage/user-notes.php