This may be something so stupidly simple I'm not seeing it. Doing a file upload & rename, then sending it to a confirmation page. File upload & rename works perfectly. But when the script is finished, I get a blank page and it does not redirect to mypage.php. I suspect the last IF statement. Anyone see what I am missing?
<?php
require "db_conn.php";
$ID=$_POST['ID'];
if ($_FILES['wimage']['error'] > 0)
{
echo 'Problem: ';
switch ($_FILES['wimage']['error'])
{
case 1: echo 'File exceeded upload_max_filesize'; break;
case 2: echo 'File exceeded max_file_size'; break;
case 3: echo 'File only partially uploaded'; break;
case 4: echo 'No file uploaded'; break;
}
exit;
}
// put the file where we'd like it
$upfile = $SCIMAGEPATHLISTINGS.'/'.$_POST['ID'].'.jpg';
if (is_uploaded_file($_FILES['wimage']['tmp_name']))
{
if (!move_uploaded_file($_FILES['wimage']['tmp_name'], $upfile))
{
echo 'Problem: Could not move file to destination directory';
exit;
}
}
else
{
echo 'Problem: Possible file upload attack. Filename: ';
echo $_FILES['wimage']['name'];
exit;
}
if (move_uploaded_file($_FILES['wimage']['tmp_name'], $upfile))
{
header ("Location: mypage.php?ok=add&Address=$ID");
}
?>