fri3ndly Posted January 11, 2008 Share Posted January 11, 2008 I have a fully functional user upload form now which I am pleased about, however the uploaded files cannot be deleted as they are uploaded with permissions of '600'. Is there any way in this script I can change it so that all uploaded files are automatically set to '755'? <?php // If there is no such folder yet, create one $upload_save_dir = $user_id; if(!file_exists($target_path)){ mkdir($target_path); echo "A folder has been created for user '$FileUser'<br />"; } /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['FileName']['name']); $_FILES['FileName']['tmp_name']; if(move_uploaded_file($_FILES['FileName']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['FileName']['name']). " has been uploaded<br />"; } else{ echo "There was an error uploading the file, please try again!<br />"; } ?> Link to comment https://forums.phpfreaks.com/topic/85511-solved-uploading-new-files-via-form-chmods-to-600/ Share on other sites More sharing options...
fri3ndly Posted January 11, 2008 Author Share Posted January 11, 2008 Solved it.... <?php if(move_uploaded_file($_FILES['FileName']['tmp_name'], $target_path)) { chmod($target_path, 0755); echo "The file ". basename( $_FILES['FileName']['name']). " has been uploaded<br />"; } else{ echo "There was an error uploading the file, please try again!<br />"; }?> Thanks Nathan! Link to comment https://forums.phpfreaks.com/topic/85511-solved-uploading-new-files-via-form-chmods-to-600/#findComment-436408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.