Windows 7 上的 Zend PHP 上传文件权限
我在 Windows 7 上运行 Zend Server CE。默认情况下,我将 Apache 作为服务运行,以本地系统帐户登录。
我的上传操作将上传的文件保存到其目标位置,但该文件的权限设置为仅 SYSTEM、管理员和 IIS_IUSERS。
上传后,我无法使用 PHP 打开或移动它。我使用以下代码在 POST 上接收 Zend Framework 中的文件:
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination($_SERVER['DOCUMENT_ROOT']. "/".$upFolder);
if (!$upload->isValid()) {
$messages = $upload->getMessages();
throw new Exception( implode("\n", $messages));
}else{
try {
$upload->receive();
}
catch (Zend_File_Transfer_Exception $e)
{
throw new Exception('Bad file: '.$e->getMessage());
}
How can I set Permissions so that I can use the uploaded file in php/zend
I have Zend Server CE running on Windows 7. By Default I have Apache running as a Service, Log On as Local System Account.
My upload Action saves an uploaded file to its Destination OK, however the permission on the file is set to only SYSTEM, Administrators and IIS_IUSERS.
Once uploaded, I cannot open it or move it using PHP. I am using the following code to receive the file in Zend Framework on POST:
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination($_SERVER['DOCUMENT_ROOT']. "/".$upFolder);
if (!$upload->isValid()) {
$messages = $upload->getMessages();
throw new Exception( implode("\n", $messages));
}else{
try {
$upload->receive();
}
catch (Zend_File_Transfer_Exception $e)
{
throw new Exception('Bad file: '.$e->getMessage());
}
How can I set permissions so that I can use the uploaded file in php/zend
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管有些人提出了建议,但关闭 UAC 并不是答案。此类问题通常是由您的 Zend Server 设置引起的,而不是 UAC 本身。检查父目录权限(所有权、读/写权限等),因为权限通常设置为由任何子文件/文件夹继承。
如果您无法通过调整权限来解决此困境:
您是否尝试过全新安装 Zend Server?首先,我会尝试安装 Zend Server,不以管理员身份运行? (我在安装过程中从未以管理员身份运行 Zend Server,并且迄今为止没有遇到任何问题。)
Despite the suggestion of some, turning UAC off is not the answer. This kind of issue is typically caused by your Zend Server setup, not UAC per se. Check the parent directory permissions (ownership, read/write permissions, etc.), as the permissions are often set to be inherited by any child files/folders.
If you can't resolve this dilemma via adjustments to permissions:
Have you tried a fresh install of Zend Server? First, I would try installing Zend Server without running "as administrator?" (I never run Zend Server as admin. during installation, and haven't had any issues to date.)