I’m having trouble getting the ‘header location’ below to work after all the if statements are passed. Either it takes me to the admin_images_successful.php page or gives me the warning headers already sent message depending on where I place it. I’m hoping it’s simple but I have tried for many hours and can’t get a satisfactory result. Any help would be very welcome.
Thanks
Brian
Code: Select all
<?
$nomessage='';
if ($_POST && array_key_exists('MM_insert',$_POST)) {
if (isset($_POST['fupload']) && !empty($_POST['fupload'])) {
}
else {
$nomessage = 'You must fill out the field';}
if (isset($_FILES['fupload'] )) {
print "name: ". $_FILES['fupload']['name'] . "<br />";
print "size: ". $_FILES['fupload']['size']. "bytes<br />";
print "temp name: ". $_FILES['fupload']['tmp_name']. "<br />";
print "type: ". $_FILES['fupload']['type']. "<br />";
print "error: ". $_FILES['fupload']['error']. "<br />";
if ( $_FILES['fupload']['type'] == "image/jpeg") {
$source = $_FILES['fupload']['tmp_name'];
$target = "gallery_06/" .$_FILES['fupload']['name'];
move_uploaded_file( $source, $target ); // or die ("coultn't copy");
$size = getimageSize($target);
$imgstr = "<p><img width=\"$size[0]\" height=\"$size[1]\" ";
$imgstr .= "src=\"$target\" alt=\"uploaded image\" /> </p>";
print $imgstr;
}} }
header('Location: admin_images_successful.php');
?>