Why is this not redirecting? I want it to redirect with a url variable but I can't even get it to go to aol.com...I hit upload and I get a blank page when I go back I see the file has uploaded so what I am doing that is not allowing for the header to redirect? Basically I want if successful redirect to editpage.php?show=$showit

$foldername = "shows/" . $_SESSION['username'] . "/" . $_SESSION['showit'] ;

if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 10000000000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
 header( "Location: http://www.lowsk.com/slideshow/login.html" );

//echo "Upload: " . $_FILES["file"]["name"] . " complete.<br />";



if (file_exists($foldername . "/" . $_FILES["file"]["name"]))
  {
  echo $_FILES["file"]["name"] . " already exists. ";
  }
else
  {
  move_uploaded_file($_FILES["file"]["tmp_name"],
  $foldername . "/" . $_FILES["file"]["name"]);
  }
}
  }
else
  {
  echo "Invalid file";
  }

    I'm going to guess you have a parse error somewhere, or you're sending content to the browser prior to the header() call.

    Put this at the top of your script (as in, on the line directly following <?php)

    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL | E_STRICT);

    Then upload and try your script again. See what it prints out (if anything).

      Your good.

      Warning: Cannot modify header information - headers already sent by (output started at **************/slideshow/sessioncheck.php:20) in ***********************slideshow/uploader.php on line 18

      The sessioncheck.php is my include file on all my pages to check for sessions. How do I get around this?

        o.k. got it...I had a whitespace at the end of my include file. Thanks I appreciate your help.

          So I'm getting the same message with another page...I definitely don't have any spaces on line 16 or 71 in this file. If I remove the

          header('location: http://www.example.com/order.php?qty=12&item=nuts');

          then everything is fine.

          Warning: Cannot modify header information - headers already sent by (output started at *****/slideshow/addshow.php:16) in *******/slideshow/addshow.php on line 71

          Could it be anything else besides the whitespace? I have searched many times and there is definitely no whitespaces before or after the <?php and ?> . I have also removed any whitespace on the bottom of the page (it ends with html).

            lowsky13 wrote:

            Your good.

            You should search the boards to realize that whitespace and other output is the most common reason the header function fails.

            This is the reason why some developers tend to leave off the closing ?> from include scripts. If there is no defined close of the php file, there can't be any trailing whitespace 😉

            Glad to hear I could help you figure it out.

            EDIT: Just realized you posted again during my reply. What is the contents of the included file "addshow.php"?

              Can you show us the contents of addshow.php from lines 1-17?

                Write a Reply...