I'm using an upload script, that works fine. I simply want to re-direct the user once he selects the Submit button. I was told to add
header("Location: http://www.gosomewhere.com");
at the bottom of the file, right after: return $message;
Did it. But the user does not get re-directed.
I tried this too, without success:
return $message;
header("Location: http://www.somelocation.com");
echo $message;
Here's the bottom part of the script page. Any help will be greatly appreciated.
If you need the whole page code, let me know.
Thanks.
function upload_file($upload_directory, $upload_uri) {global $account;
$file_name = $_FILES["userfile"]["name"];
$file_name = str_replace(" ","_",$file_name);
$ext=pathinfo($file_name,PATHINFO_EXTENSION);
$file_name = basename($file_name, '.' . $ext);
$file_path = $upload_directory. $file_name.'~~'. $account->get_user_name().'.'.$ext;
$temporary = $_FILES["userfile"]["tmp_name"];
$result = move_uploaded_file($temporary, $file_path);
if(!chmod($file_path,0777))
$message = "ERROR: A folder to place the files was not found, or the files need to be CHMODed to 777.";
else $message = ($result)?"File has been uploaded." : "An error has occurred.";
return $message;
header("Location: http://www.somelocation.com");
}
?>