PHP文件上传问题 [英] PHP File Uploading Issues

查看:100
本文介绍了PHP文件上传问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现脚本,该脚本将允许上传文件,然后将其移动到指定目录. 此程序正在Windows服务器上运行& IIS.我这样做有两个问题.

I'm trying to implement script that will allow a file to be uploaded, and then moved to a designated directory. This is running on a Windows server & IIS. I'm having 2 issues in doing so.

首先,尝试移动文件时出现错误.

First, I get an error when trying to move the file.

Warning: move_uploaded_file(reports/ff.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\inetpub\wwwroot\betterinsight\betterinsight\upload_file.php on line 29

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\Temp\php1EAB.tmp' to 'reports/ff.jpg' in C:\inetpub\wwwroot\betterinsight\betterinsight\upload_file.php on line 29
Stored in: reports/ff.jpg

搜索时,几乎所有内容都表明存在权限问题.我已向用户IIS_IUSRS添加了完整权限(稍后将删除).甚至建议将其添加到父目录(作为一个站点).

When searching, almost everything says it's a permission problem. I have added full rights (will pare down later) to the user: IIS_IUSRS. Even did it to the parent directory as one site recommended.

第二:作为上述问题的一种可能的解决方案,我试图更改保存文件的目录.但是文件仍上传到 C:\ windows \ temp .
我已经运行了phpinfo,它说应该在上传文件中(由 upload_tmp_dir 定义):

Second: As a possible solution to the above issue, I tried changing the directory in which files are saved. But the files are still uploaded into C:\windows\temp.
I've run phpinfo, and it says that uploads should be in (as defined by upload_tmp_dir):

同样,这是在Windows Server 2008上.谢谢.

Again, this is on a Windows Server 2008. Thanks.

推荐答案

好的,答案很简单.我应该为用户IIS_USRS添加权限,而该权限本来应该只是用户:USRS.

OK, the answer was simple. I was adding permissions for user: IIS_USRS, when it should have been just user: USRS.

这篇关于PHP文件上传问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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