note 70119 rejected from features.file-upload by betz
| From: | betz@php.net | Date: | Wed, 04 Oct 2006 08:40:25 +0000 |
| Subject: | note 70119 rejected from features.file-upload by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118016@lists.php.net to get a copy of this message | ||
Note Submitter: avijit6399 at yahoo dot com
----
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";
}
}
}
?>