Forums

This topic is locked

image upload

Posted 27 Feb 2006 05:45:16
1
has voted
27 Feb 2006 05:45:16 Chris Trace posted:
hey guys n girls

how can i change this so that instead of printing to a blank page the errors reloads the url instead with the error message there

$pext = strtolower($pext);
if (($pext != "jpg" && ($pext != "jpeg")
{
print "<h1>ERROR</h1>Image Extension Unknown.<br>";
print "<p>Please upload only a JPEG image with the extension .jpg or .jpeg ONLY<br><br>";
print "The file you uploaded had the following extension: $pext</p>\n";

exit();
}
$imgsize = $_FILES['imgfile']['size'];
if (move_uploaded_file($imgfile, $uploadfile)){
echo "";

}
else
{
echo "upload failed";
}

if (is_uploaded_file($imgfile))
{
if (!copy($imgfile,"$newfile")
{
print "Error Uploading File.";
exit();

Reply to this topic