title: move_uploaded_file and file_exists return true, can't view file in browser or FTP
body: <p>The file does save to the target folder which I can access on the browser and FTP, because when I try to delete the directory it says that the folder is not empty.</p>
  
  <p>I also know they're there, because when I do a scandir(), it lists all the files.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php
  $device_name = str_replace(" ","_",strtolower($_POST["device_name"]));
  $target_dir = getcwd()."/wedding/";
  $target_dir = $target_dir.$device_name."_".time()."_".basename($_FILES["file"]["name"]);
  $arr = array();
  if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_dir)) {
      $arr["status"] = 1;
      $arr["result"] = "Photo Sent";
  } else {
      $arr["status"] = 0;
      $arr["result"] = "Error Sending Photo";
  }
  echo json_encode($arr);
  ?&gt;
  </code></pre>