title: Files corrupted after upload
body: <p>I have a pretty simple upload script I'm playing around with in a localhost dev environment.  The form takes a file and posts it to a receiving script which saves the file.  Basically your stock-standard PHP file upload form.</p>
  
  <hr>
  
  <p><strong>uploader.php</strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;File upload test&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action="upload_receiver.php" method="POST" enctype="multipart/form-data"&gt;
              &lt;input name="upload_file" type="file"/&gt;
              &lt;input name="upload_submit" type="submit"/&gt;
          &lt;/form&gt;
          &lt;script&gt;
  
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>upload_receiver.php</strong></p>
  
  <pre><code>&lt;?php
  
  $upload_dir = "uploads/";
  
  if ($_SERVER['REQUEST_METHOD'] == 'POST')
  {
      if (move_uploaded_file($_FILES['upload_file']['tmp_name'], $upload_dir . basename($_FILES['upload_file']['name'])))
      {
          echo 'success';
      }
  }
  </code></pre>
  
  <p>The problem is, every single file I attempt to 'upload' is arriving in my 'uploads' folder seem as though they may be in a corrupted state and will no longer open.  I can't even open them in Notepad++ to view the contents of the files, Notepad++ throws an error: "Access is denied."</p>
  
  <p>Has anyone encountered this before?  Any ideas why this might be happening, and how I can correct it?</p>
  
  <ul>
  <li><strong>Operating System:</strong> Windows</li>
  <li><strong>Web Server:</strong> Apache</li>
  <li><strong>PHP Version:</strong> PHP 5.5.6</li>
  </ul>
  
  <hr>
  
  <p><em>Edit to clarify some questions raised in comments:</em></p>
  
  <p><s>I'm guessing that the files are corrupted because I have full access to the folder they are being uploaded to, and I can see the files there, but if I click on an image for example, I can't see the preview thumbnail.</p>
  
  <p>It's true that the problem may not be corruption, I've rephrased the question to say that they <em>seem</em> to be corrupted.</s></p>
  
  <p>I do see "success" after the submit, and there are no errors in the Apache logs.</p>
  
  <p><code>max_upload_size</code> is 500M. <code>post_max_size</code> is 500M.</p>
  
  <hr>
  
  <p><em>Edited again:</em></p>
  
  <p>After comparing MD5 hashes as helpfully suggested by I'L'I, I've determined that the files are fine (they're not corrupted).  It's an access problem.  I will be able to fix this using this question: <a href="https://stackoverflow.com/questions/4714825/change-permissions-of-file-uploaded-by-php">Change permissions of file uploaded by PHP</a></p>
  
  <p>Thank you to all the commenters who helped with this.</p>