title: PHP: Use temporary image file on another page.
body: <p>I let the user upload an image. It then creates a temp file but I don't want to move it to a permanent address yet because I want to take them to <code>cropphoto.php</code> where they can create a thumbnail from it. If they exit out of the window before this I don't want it to be saved.</p>
  
  <p>How would I pass the temporary image from the following script:</p>
  
  <pre><code>&lt;?php 
  include_once '../dbconnect.php'; 
  $protocol = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
  $domain = $protocol. $_SERVER['SERVER_NAME'];
  
  function findexts ($filename) {
      $filename = strtolower($filename) ;
      $exts = split("[/\\.]", $filename) ;
      $n = count($exts)-1;
      $exts = $exts[$n];
      return $exts;
  }
  
  $SubcatID = $_POST['SubcatID'];
  if (empty($SubcatID)){
      $SubcatID = -1;
  }
  
  $ext = findexts ($_FILES['photo']['name']) ; 
  if ($ext == "jpg" || $ext == "jpeg") {
      $return = 'cropphoto.php?PhotoID='.urlencode($_FILES['photo']['name']);
      header("Location: $return");
  } 
  else {
      echo "ERROR: The image must be a JPEG";
      exit;
  }
  ?&gt; 
  </code></pre>
  
  <p>The current url paramater im using just passes the image name but I can't find the temp folder it is in.</p>