title: can i use the function md5_file to name files when upload without having conflict with names?
body: <p>all the idea i need to be sure that the file doesn't saved more than one time and don't lose any file because if tow files get the same (md5) the second file will not saved
  <strong>(my goal don't save the same file Twice on hard disk)</strong></p>
  
  <p><strong>In other words,</strong>
  if one user upload image and after that another user upload the same image i need to don't save the the second image because it's already exist in the hard disk all of this because
  i need to save space on my hard disk
  this is my code it works fine</p>
  
  <pre><code>$targetFolder = '/test/uploadify/uploads'; // Relative to the root
  $tempFile = $_FILES['Filedata']['tmp_name'];
  $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
  
  $myhash = md5_file($_FILES['Filedata']['tmp_name']);
  $temp = explode(".", $_FILES['Filedata']['name']);
  $extension = end($temp);
  
  $targetFile = rtrim($targetPath,'/') . '/' .$myhash.'.'.$extension;
  if(file_exists($targetFile)){
      echo 'exist';
  }
  
  // Validate the file type
  $fileTypes = array('jpg','jpeg','gif','png'); // File extensions
  $fileParts = pathinfo($_FILES['Filedata']['name']);
  if (in_array($fileParts['extension'],$fileTypes)) {
      move_uploaded_file($tempFile,$targetFile);
  } 
  else {
      echo 'Invalid file type.';
  }
  </code></pre>
  
  <p>thanks for all of you</p>