Notice: Unknown: 在第0行Unknown的系统临时目录下创建的文件
Notice: Unknown: file created in the system's temporary directory in Unknown on line 0
我只是使用 html 表单上传文件。
但我遇到以下错误:
Notice: Unknown: file created in the system's temporary directory in
Unknown on line 0
这是我的 HTML:
<form name="import" method="post" action="CSVUpload" enctype="multipart/form-data">
<input type="file" name="file" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
路线如下:
$f3->route('POST|PUT @CSVUpload: /CSVUpload', 'GBD\Internals\Controllers\LeaveController->csvHandler');
$f3->route('GET /CSVUpload', 'GBD\Internals\Controllers\LeaveController->csv');
这是我的控制器:
public function csv()
{
$this->f3->set('content', 'leave/csvUploader.php');
$template = new \View;
echo $template->render('dashboard/layout.php');
}
public function csvHandler()
{
$postvalue = $this->f3->get('POST.submit');
if(isset($postvalue))
{
$fileReceived = $this->f3->get('POST.file');
var_dump($fileReceived);
}
}
我正在使用 fat-free 框架。
我发现上传的文件被临时存储到upload_tmp_dir="C:\inetpub\temp"
。
这里有什么问题??
非常感谢任何帮助。谢谢。
这不是错误,这是通知。参见 this request。基本上,它只是告诉您它已退回到系统的默认临时目录,而不是您提供的更具体的内容。您可以将其覆盖为更具体的内容(例如专门针对此应用程序的临时目录)或通过 error_reporting()
禁用通知。我会推荐前者。
确保您要保存内容的目录是可写。
例如,在我的例子中,它是一个必须可写的 Concrete 5 目录。
如果您的 php.ini
路径错误 upload_tmp_dir
,也会发生这种情况。
p.s。 error_reporting()
.
可能无法禁用它
花了 3 小时后,我发现我不小心从我的 windows 10 env 变量中删除了 temp 和 tmp,通过添加如下路径,我的问题得到解决
我只是使用 html 表单上传文件。
但我遇到以下错误:
Notice: Unknown: file created in the system's temporary directory in Unknown on line 0
这是我的 HTML:
<form name="import" method="post" action="CSVUpload" enctype="multipart/form-data">
<input type="file" name="file" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
路线如下:
$f3->route('POST|PUT @CSVUpload: /CSVUpload', 'GBD\Internals\Controllers\LeaveController->csvHandler');
$f3->route('GET /CSVUpload', 'GBD\Internals\Controllers\LeaveController->csv');
这是我的控制器:
public function csv()
{
$this->f3->set('content', 'leave/csvUploader.php');
$template = new \View;
echo $template->render('dashboard/layout.php');
}
public function csvHandler()
{
$postvalue = $this->f3->get('POST.submit');
if(isset($postvalue))
{
$fileReceived = $this->f3->get('POST.file');
var_dump($fileReceived);
}
}
我正在使用 fat-free 框架。
我发现上传的文件被临时存储到upload_tmp_dir="C:\inetpub\temp"
。
这里有什么问题??
非常感谢任何帮助。谢谢。
这不是错误,这是通知。参见 this request。基本上,它只是告诉您它已退回到系统的默认临时目录,而不是您提供的更具体的内容。您可以将其覆盖为更具体的内容(例如专门针对此应用程序的临时目录)或通过 error_reporting()
禁用通知。我会推荐前者。
确保您要保存内容的目录是可写。
例如,在我的例子中,它是一个必须可写的 Concrete 5 目录。
如果您的 php.ini
路径错误 upload_tmp_dir
,也会发生这种情况。
p.s。 error_reporting()
.
花了 3 小时后,我发现我不小心从我的 windows 10 env 变量中删除了 temp 和 tmp,通过添加如下路径,我的问题得到解决