title: Warning: copy(..): failed to open stream: No such file or directory in
body: <p>I'm fairly new to PHP and was trying to create a simple PHP file upload system.</p>
  <p>I followed a tutorial from (<a href="http://www.phpeasystep.com/phptu/2.html" rel="nofollow noreferrer">http://www.phpeasystep.com/phptu/2.html</a>). I only altered the <code>$HTTP_POST_FILES</code>, as it was giving me errors, and from what I read it's old in PHP.</p>
  <p>I got less error messages but I am getting an error in the <code>copy()</code> function, with these given error messages:</p>
  <pre><code>Warning: copy(Task2/uploads/anonymous.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\Task2\upload.php on line 13
  
  Warning: copy(Task2/uploads/DSCF4639.JPG): failed to open stream: No such file or directory in C:\xampp\htdocs\Task2\upload.php on line 14
  
  Warning: copy(Task2/uploads/jien maroon.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\Task2\upload.php on line 15
  </code></pre>
  <p>I thought it was a problem with permission (read/write permissions in Windows 7), but from a quick google search it seems that XAMPP is set by default to deal with permission on Win 7.</p>
  <p>This is the code:</p>
  <pre><code>&lt;?php
  
  //set where you want to store files
  //in this example we keep file in folder upload
  //$_FILES['ufile']['name']; = upload file name
  //for example upload file name cartoon.gif . $path will be upload/cartoon.gif
  
  $path1= &quot;Task2/uploads/&quot;.$_FILES['ufile']['name'][0];
  $path2= &quot;Task2/uploads/&quot;.$_FILES['ufile']['name'][1];
  $path3= &quot;Task2/uploads/&quot;.$_FILES['ufile']['name'][2];
  
  //copy file to where you want to store file
  copy($_FILES['ufile']['tmp_name'][0], $path1);
  copy($_FILES['ufile']['tmp_name'][1], $path2);
  copy($_FILES['ufile']['tmp_name'][2], $path3);
  
  //$_FILES['ufile']['name'] = file name
  //$_FILES['ufile']['size'] = file size
  //$_FILES['ufile']['type'] = type of file
  echo &quot;File Name :&quot;.$_FILES['ufile']['name'][0].&quot;&lt;BR/&gt;&quot;;
  echo &quot;File Size :&quot;.$_FILES['ufile']['size'][0].&quot;&lt;BR/&gt;&quot;;
  echo &quot;File Type :&quot;.$_FILES['ufile']['type'][0].&quot;&lt;BR/&gt;&quot;;
  echo &quot;&lt;img src=\&quot;$path1\&quot; width=\&quot;150\&quot; height=\&quot;150\&quot;&gt;&quot;;
  echo &quot;&lt;P&gt;&quot;;
  
  echo &quot;File Name :&quot;.$_FILES['ufile']['name'][1].&quot;&lt;BR/&gt;&quot;;
  echo &quot;File Size :&quot;.$_FILES['ufile']['size'][1].&quot;&lt;BR/&gt;&quot;;
  echo &quot;File Type :&quot;.$_FILES['ufile']['type'][1].&quot;&lt;BR/&gt;&quot;;
  echo &quot;&lt;img src=\&quot;$path2\&quot; width=\&quot;150\&quot; height=\&quot;150\&quot;&gt;&quot;;
  echo &quot;&lt;P&gt;&quot;;
  
  echo &quot;File Name :&quot;.$_FILES['ufile']['name'][2].&quot;&lt;BR/&gt;&quot;;
  echo &quot;File Size :&quot;.$_FILES['ufile']['size'][2].&quot;&lt;BR/&gt;&quot;;
  echo &quot;File Type :&quot;.$_FILES['ufile']['type'][2].&quot;&lt;BR/&gt;&quot;;
  echo &quot;&lt;img src=\&quot;$path3\&quot; width=\&quot;150\&quot; height=\&quot;150\&quot;&gt;&quot;;
  
  ///////////////////////////////////////////////////////
  
  // Use this code to display the error or success.
  
  $filesize1=$_FILES['ufile']['size'][0];
  $filesize2=$_FILES['ufile']['size'][1];
  $filesize3=$_FILES['ufile']['size'][2];
  
  if($filesize1 &amp;&amp; $filesize2 &amp;&amp; $filesize3 != 0)
  {
  echo &quot;We have recieved your files&quot;;
  }
  
  else {
  echo &quot;ERROR.....&quot;;
  }
  
  //////////////////////////////////////////////
  
  // What files that have a problem? (if found)
  
  if($filesize1==0) {
  echo &quot;There're something error in your first file&quot;;
  echo &quot;&lt;BR /&gt;&quot;;
  }
  
  if($filesize2==0) {
  echo &quot;There're something error in your second file&quot;;
  echo &quot;&lt;BR /&gt;&quot;;
  }
  
  if($filesize3==0) {
  echo &quot;There're something error in your third file&quot;;
  echo &quot;&lt;BR /&gt;&quot;;
  }
  ?&gt;
  </code></pre>
  <p>Any help would be appreciated !</p>
  <p>Thanks !</p>