File permessions after uplaod

File permessions after uplaod

Khalid TeliKhalid 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

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    If you are using PHP's move_uploaded_file() you could follow it with a call to PHP's chmod() 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

  • Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

    @allan Thank you.

    The thread has the answer in it :)

Sign In or Register to comment.