After moving files using move_uploaded_file the files are locked from further modification (such as rename). This is on my local server (localhost) running Ubuntu 14 and using Codeigniter framework. The upload directory is set to 777 (I know bad, but its just easier for my dev environment). This does not appear to be happening in production. They remain locked after the script is complete and even after the browser is closed. Here is the code.
public function upload_photos($pid = '', $timestamp = 0, $files = array()) {
$uploadpath = $this->post_model->photo_upload_path($timestamp);
$count = 0;
foreach ($files as $file) {
$file["tmp_name"] !== '' ? $check = getimagesize($file["tmp_name"]) : $check = FALSE;
if ($check !== FALSE && $file["size"] <= MAX_PHOTO_SIZE) {
$target_file = $uploadpath . 'dd-' . $pid . '-' . $count . '.' . strtolower(end(explode('.', $file['name'])));
if (move_uploaded_file($file["tmp_name"], $target_file)) {
$count++;
}
}
}
return $count;
}