简体   繁体   中英

PHP-uploaded file has incorrect permissions

I'm using PHP to allow a user to upload a file. The file is being uploaded, but the permissions on the file are incorrect. I set up the permissions on the folder and checked the box that says apply to all children in the folder.

This works only after I make one change to the newly uploaded file. If I don't make a change to the permissions, it gets this default set that breaks the rest of my application.

For example, C:\\uploads\\ is set to allow users in the group "Everyone" to read and write. This however doesn't apply to the newly uploaded file until I do something to that specific file's permissions (add or remove any user or group to its permissions - this change gets overwritten by the folder's permissions).

This is on IIS6 (I believe) on Windows Server 2003

Windows upload file to temp directory and then move it with temp directory permissions. If You give good permissions to the user on this folder (upload_tmp_dir) then will be no problem. You can also use windows system command: CACLS or ICACLS

Do:

chmod()

On Your file after upload

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM