I have this problem for quite a time and cannot get the solution.
I have simple form that allows user to upload file. File is moved from temporary location to specified location on site and it is available for downlaod through direct link to file.
Problem is that file does not get proper permissions and it is not accessible by user.
Code I use is this (simplified):
File is stored in proper place but its permissions are 600
I even tried to force permissions after file is moved, but it does not work. I tried chmod($putfile, 644) which should be set and even chmod($putfile, 777) but then i get really strange permission like 411.
All this worked fine before some server upgrade occured so I guess it may be some problem with server setting.
By searching net, I have found one interesting observation that may be related to my problem: "It seems that move_uploaded_file use the GROUP permissions of the parent directory of the tmp file location".
That could explain that permissions of moved file are wrong, byt why setting permissions on the file does not work?
I have simple form that allows user to upload file. File is moved from temporary location to specified location on site and it is available for downlaod through direct link to file.
Problem is that file does not get proper permissions and it is not accessible by user.
Code I use is this (simplified):
Code:
$file = strtolower($_files['f_file']['name']); $putfile = UPLOAD_FILES_PATH . $file; move_uploaded_file($_files['f_file']['tmp_name'], $putfile))
I even tried to force permissions after file is moved, but it does not work. I tried chmod($putfile, 644) which should be set and even chmod($putfile, 777) but then i get really strange permission like 411.
All this worked fine before some server upgrade occured so I guess it may be some problem with server setting.
By searching net, I have found one interesting observation that may be related to my problem: "It seems that move_uploaded_file use the GROUP permissions of the parent directory of the tmp file location".
That could explain that permissions of moved file are wrong, byt why setting permissions on the file does not work?
Comment