File permessions after uplaod
File permessions after uplaod
Khalid Teli
Posts: 251Questions: 71Answers: 0
Hi,
I am using the file upload to upload files to a specific folder using :
$tmpname = $file[ 'tmp_name' ];
move_uploaded_file( $tmpname, 'C:/test/'.$fld.'/'.$name);
However, the issue is, after uploading the files, the file permissions change from EVERYONE to System?. So for some users these files doesn't get displayed
How can I address this issue?
Thank you
Answers
If you are using PHP's
move_uploaded_file()
you could follow it with a call to PHP'schmod()
function to set the file permissions as you need.Looks like you are using Windows as your server - my understanding is that PHP#s
chmod()
will still work for setting read permissions. For much more than that, you might need to delve into PHP's ability to set file permissions a little more than just that though - this SO thread looks like a good start.Allan
@allan Thank you.
The thread has the answer in it