简体   繁体   English

PHP上载的档案具有不正确的权限

[英]PHP-uploaded file has incorrect permissions

I'm using PHP to allow a user to upload a file. 我正在使用PHP允许用户上传文件。 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. 例如,将C:\\uploads\\设置为允许“所有人”组中的用户进行读写。 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 Server 2003上的IIS6(我相信)

Windows upload file to temp directory and then move it with temp directory permissions. Windows将文件上传到temp目录,然后使用temp目录权限将其移动。 If You give good permissions to the user on this folder (upload_tmp_dir) then will be no problem. 如果您在此文件夹(upload_tmp_dir)上为用户提供了良好的权限,则不会有问题。 You can also use windows system command: CACLS or ICACLS 您也可以使用Windows系统命令:CACLS或ICACLS

Do: 做:

chmod() CHMOD()

On Your file after upload 上传后在您的文件上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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