由PHP修改的文件的奇怪权限move_uploaded_file() [英] Odd permissions on file modified by PHP move_uploaded_file()

查看:151
本文介绍了由PHP修改的文件的奇怪权限move_uploaded_file()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows Server 2003 Enterprise框上运行PHP 5.2.6。 IIS设置为拒绝匿名访问并使用集成Windows身份验证。

我使用PHP脚本来保存从Web表单上传的文件。该文件被上传到一个临时文件夹,该脚本根据Web表单中的其他变量创建一个文件名和路径,然后该脚本使用PHP的move_uploaded_file()将该临时文件移动到最终位置。所有的工作正常。总之,人们正在上传文件,所以群中的每个人都可以看到他们,文件是由脚本组织的。



我的问题是最终位置的文件有奇怪的权限。它不会以临时位置或最终位置的权限结束。临时地点和最终地点都具有相同的权限:所有者和主管部门的完全权利;读取和读取/执行2个特定的AD安全组。最终文件只有:所有者和管理部门的完整权利。所以当管理员和原始的上传者查看文件没有问题的时候,组中的所有其他人在访问时都会得到权限被拒绝。



任何想法或建议将不胜感激!谢谢!

解决方案这似乎是 move_uploaded_file() function:

http://us3.php.net/ 请注意下面的注释,注意Florian对copy()的评论。



将复制()解决问题?:

http ://us3.php.net/manual/en/function.copy.php

I'm running PHP 5.2.6 on a Windows Server 2003 Enterprise box. IIS is set to deny anonymous access and use Integrated Windows authentication.

I'm using a PHP script to save a file uploaded from a web form. The file is uploaded to a temp folder, the script creates a file name and path depending on other variables from the web form, and then the script uses PHP's move_uploaded_file() to move the temp file to the final location. All that works fine. In short, people are uploading files so everyone in the group can see them and the files are organized by the script.

My problem is that the file in the final location has odd permissions. It is not ending up with permissions from either the temp location or the final location. Both the temp location and final location have the same permissions: full rights for owner and administrations; read and read/execute for 2 specific AD security groups. The final file ends up with only: full rights for owner and administrations. So while the admins and the original uploader have no problem viewing the file, all others in the group get "permission denied" when trying to access it.

Any ideas or suggestions will be greatly appreciated! Thanks!

解决方案

This seems to be an issue with the move_uploaded_file() function:
http://us3.php.net/move_uploaded_file
Take a look at the comments below, take note of Florian's comment about copy().

Would copy() solve the issue?:
http://us3.php.net/manual/en/function.copy.php

这篇关于由PHP修改的文件的奇怪权限move_uploaded_file()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆