verifying cookies

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 802 Views - Last Post: 25 February 2014 - 03:52 PM

#16 Brandon222  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 16-November 08

Re: verifying cookies

Posted 25 February 2014 - 03:37 PM

could it be also a premission issue somewhere, or a file location problem?
Was This Post Helpful? 0
  • +
  • -

#17 ArtificialSoldier  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 1,814
  • Joined: 15-January 14

Re: verifying cookies

Posted 25 February 2014 - 03:52 PM

PHP saved the uploaded file to a temporary location, so PHP has access to it. If you want, print out the content of the $_FILES array, you can use print_r for that:

print_r($_FILES);

That will show you everything that's there. The error code will be set to something other than 0 if there was an error with the upload (i.e. too big, couldn't save the temp file, etc). The PHP manual lists the various upload error codes.

Like was previously said though, the temp file gets deleted when the script ends. So, if you print out the name of the temp file you won't be able to use FTP to verify it's there (you might not even have FTP access to the location where it's saved). If you want to verify that the uploaded file is correct then you can use the move_uploaded_file function to move it somewhere where you have access to check it (and so it won't get deleted).

http://www.php.net/m...loaded-file.php

If you want to verify that the file is uploaded correctly with PHP, you can do something like this:

if (isset($_FILES['uploaded_file']) &&
    $_FILES['uploaded_file']['error'] == UPLOAD_ERR_OK) {
    $mail->AddAttachment($_FILES['uploaded_file']['tmp_name'],
                         $_FILES['uploaded_file']['name']);
    if (file_exists($_FILES['uploaded_file']['tmp_name'])) {
      echo 'The uploaded file ' . $_FILES['uploaded_file']['tmp_name'] . ' exists.';
    }
    if (is_readable($_FILES['uploaded_file']['tmp_name'])) {
      echo 'The uploaded file ' . $_FILES['uploaded_file']['tmp_name'] . ' is readable.';
    }
} 
else {
  echo 'No file was uploaded or there was an error.';
}

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2