Jump to content

Uploading Weirdness


rawky1976

Recommended Posts

Hello

 

The following upload script uploads the file to the server as expected but always re-directs to the upload failure page???

 

Something wrong with my if statement???

 

<?php

 

if(isset($_POST['buttonSubmit'])) {

$uploadpath = "uploads/";

 

$uploadpath = $uploadpath . basename( $_FILES['uploadFile']['name']); 

 

if(move_uploaded_file($_FILES['uploadFile']['tmp_name'], $uploadpath)) {

 

 

    echo"This file: ".  basename( $_FILES['uploadFile']['name']). "has been uploaded Other Details:";

    echo"Mime Type: ". $_FILES['uploadFile']['type'] ."";

    echo"Size (Bytes): ". $_FILES['uploadFile']['size'] ."";

    echo"File Name: ". $_FILES['uploadFile']['name'] ."";

 

 

else {

    echo "There was an error uploading the file, please try again!";

}

 

define("no_error", "uploadSuccess.php");

define("yes_error", "uploadError.php");

 

  if(empty($errStr)){

if(@copy($_tmp_name_,uploadpath . "/" . $_name_)){

header("Location: " . no_error);

} else {

header("Location: " . yes_error);

}

} else {

header("Location: " . yes_error);

}

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/37535-uploading-weirdness/
Share on other sites

If I comment out: -

 

define("no_error", "uploadSuccess.php");

  define("yes_error", "uploadError.php");

 

  if(empty($errStr)){

      if(@copy($_tmp_name_,uploadpath . "/" . $_name_)){

        header("Location: " . no_error);

      } else {

        header("Location: " . yes_error);

      }

  } else {

      header("Location: " . yes_error);

  }

}

 

Then I get the success message on the original page, and the file uploads. Definitely something in this if statement!?

Link to comment
https://forums.phpfreaks.com/topic/37535-uploading-weirdness/#findComment-179457
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.