Reputation: 111
I have a PHP upload script and am trying to make it so that the uploaded files can be editable and readable by all users of my website (i.e., set the file permissions of the uploaded-file to chmod 777
). The directory to which the files are uploaded to has the correct permissions. However, the uploaded files do not. Because new files will be constantly uploaded, I need to have some sort of code built in to the upload process that sets/changes the file permissions of the uploaded file upon uploading.
Any thoughts?
Upvotes: 3
Views: 7418
Reputation: 2423
Just use chmod()
after your upload functions..
<?php
/*
* All your upload code here; then pass the filename
* and the base permissions to the chmod() below
*/
chmod($uploadedFile, 0777);
?>
Upvotes: 3