【发布时间】:2015-06-27 01:43:56
【问题描述】:
我在 php/laravel 中进行文件上传。文件进入public/uploads 目录。
但是,如果我访问 URL testlocal/site/public/uploads/files.pdf 上的文件,我会收到此错误:
HTTP-Error 500.50 - URL Rewrite Module Error.
但是,如果我将此文件从普通 Windows 资源管理器复制到 public/uploads 目录,它可以工作:|
我的网络配置
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
还有我的文件上传
if (Input::hasFile('file')) {
$file = Input::file("file");
$size = $file->getSize();
$originalName = $file->getClientOriginalName();
$fileName = time() . "-" . str_random(5);
$extension = $file->getClientOriginalExtension();
if($file->move(__DIR__ . '/../../../public/uploads/', $fileName . "." . $extension)) {
$upload = new Upload();
// ...
$upload->save();
$answer = array( 'answer' => 'File transfer completed' );
$json = json_encode( $answer );
echo $json;
}
错误代码:0x80070005
// 编辑:好的,如果我给他们文件everyone 访问权限,它可以工作......但是我怎样才能让它自动化呢?
【问题讨论】: