title: Can't set upload_tmp_dir to a dir on non-PHP drive?
body: <p>PHP experts, I've been working on this problem for about a day and a half, and I'm at a loss. If I'm right, I've discovered an arguably huge oversight in PHP.. one I can't believe isn't causing problems for others, and while I've found others having the same problem via Google, all of them have accepted defeat. One even filed a bug with PHP, and it was eventually closed due to lack of activity.</p>
  
  <p>I'm running PHP 5.3 w/ Apache in a WAMP stack.</p>
  
  <p>I'm doing a simple file upload (followed by a move from the tmp location), and for security and speed reasons, I'd like the initial upload temp directory (upload_tmp_dir) to be on a different disk where the file will end up after the move, which happens to be a network share. Z:\temp. Normally, it resides on the same disk as PHP, but this would mean that I have to upload a potentially large file, then wait for it to copy to another disk.. rather than just upload it to the other disk AS the temp, and perform a quick move.</p>
  
  <p>example:</p>
  
  <pre><code>//upload_tmp_dir = Z:\Temp (set in php.ini)
  $targetpath = Z:\Data\pdfs (final destination)
  move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $targetpath);
  </code></pre>
  
  <p>Theoretically, this should upload the file temporarily to Z:\Temp, then once it completes without errors, move it to its' final destination of Z:\Data\pdfs\filename.pdf.</p>
  
  <p>I've confirmed that file uploading and moving works as long as upload_tmp_dir is on the same drive PHP is.. i.e. C:\MyTemp, but will NOT work if I traverse to a different drive like Z:\Temp. The value I specified in php.ini for upload_tmp_dir is simply ignored, and the file gets stored in C:\Windows\Temp if I try to traverse to a different drive/partition. Seems to make no difference that it's a mapped drive. Permissions are all set correctly, both share and security have Everyone allowed (chmod 777 equivalent).</p>
  
  <p>I've read in multiple locations that "PHP" and specifically move_uploaded_file() "has trouble with traversing drives". This is obviously for security reasons I'd assume, but it doesn't seem it can be overridden anywhere. However, with an increasing number of servers using virtualization and SSD's with limited space, I don't understand how this is possible. If one was running a site with several hundred users uploading files at a time, how does it make sense that the temporary files (which could be huge) MUST reside on C:\ where PHP is?? Have any of you dealt with this before or have any tips?</p>
  
  <p>I keep assuming it's a permissions issue and so I've looked into other PHP and Apache settings which might be limiting the access, but even setting all the paths in open_base_dir for example doesn't seem to help anything.</p>
  
  <p>Some posts I found outlining the same or similar issues:</p>
  
  <p><a href="http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_21190386.html" rel="nofollow noreferrer">http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_21190386.html</a></p>
  
  <p><a href="https://serverfault.com/questions/128017/php-ignores-upload-tmp-dir">https://serverfault.com/questions/128017/php-ignores-upload-tmp-dir</a></p>
  
  <p><a href="https://bugs.php.net/bug.php?id=44420" rel="nofollow noreferrer">https://bugs.php.net/bug.php?id=44420</a></p>