note 16124 rejected from features.file-upload by jimw
| From: | jimw@php.net | Date: | Wed, 17 Oct 2001 07:59:22 +0000 |
| Subject: | note 16124 rejected from features.file-upload by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19031@lists.php.net to get a copy of this message | ||
if ($REQUEST_METHOD == "POST")
{
/* SUBMITTED INFORMATION - use what you need
* temporary filename (pointer): $imgfile
* original filename : $imgfile_name
* size of uploaded file : $imgfile_size
* mime-type of uploaded file : $imgfile_type
*/
/*== upload directory where the file will be stored
relative to where script is run ==*/
// $uploaddir = ".";
$uploaddir = "./images";
/*== setup final file location and name ==*/
/*== change spaces to underscores in filename (damn windows!) ==*/
$final_filename = str_replace(" ", "_", $imgfile_name);
$newfile = $uploaddir . "/$final_filename";
/*== move file to proper directory ==*/
if (!copy($imgfile,"$newfile"))
{
/*== if an error occurs the file could not
be written, read or possibly does not exist ==*/
print "Error Uploading File.";
exit();
}
echo "Sucessfully uploaded the file";
}
/*== delete the temporary uploaded file ==*/
unlink($imgfile);
print("<img src=\"./images/$final_filename\">");
}
}
?>
This is the code which i am writting in the PHP file.
My problem is that it is getting uploaded in the directory whatever path i am mentioning.
but when i am seeing in the browser i mean the path of the whole where the file is kept.it displays
no image.Yeah the image is getting uploaded.
can u plz help me out.i am facing this for a loong time.is anyone please help me out in solving the
problem.