title: hash_file is computing same value for different files
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1967409/what-is-a-good-way-to-check-if-an-image-is-unique-using-php">What is a good way to check if an image is unique using PHP?</a>  </p>
  </blockquote>
  
  
  
  <p>A user uploads an image (<code>png</code>, <code>jpg</code>, <code>gif</code>) via a form. I'm am using hash_file to check against the db to see if the image already has been uploaded but I am now noticing that it is not unique.</p>
  
  <p>Is this a bug or should I be using something else to generate a unique ID for the files?</p>
  
  <p>I guess the workaround would be <code>md5(filesize($file) . $hash)</code>?</p>
  
  <p><strong>UPDATE</strong>
  From the logs... first set is using md5_file, second from hash_file with sha256...</p>
  
  <pre>HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'd41d8cd98f00b204e9800998ecf8427e'
  HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'd41d8cd98f00b204e9800998ecf8427e'
  
  HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
  HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
  HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c
  20130117T231016: booru.pixymedia.us/utilities/batchExistingUpload.php
  HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
  HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
  HASH: SELECT SiteID FROM tbl_image_hashes WHERE SiteID = 0 AND Hash = 'e3b0c44298fc1c
  </pre>
  
  <p>And no the SQL is right... I've uploaded 3,000 files successfully with this function...</p>
  
  <p>This is the hash generating code:</p>
  
  <pre><code>$fileHash = hash_file("sha256",$FILE["tmp_name"]);
  </code></pre>
  
  <p>$FILE is basically $_FILE, it's just what the function parameter is named as</p>