【发布时间】:2017-07-19 14:15:00
【问题描述】:
我目前正在使用 Laravel 开发一个内容管理系统,但是我遇到了一个非常奇怪的问题...
//If an asset was provided
$asset = $request->file('asset');
if($asset) {
//Set the file name.
$fileName = $asset->getClientOriginalName();
//If we could move the uplaoded asset.
if(Storage::disk('local')->put('presentation_assets/'.$fileName, $asset)) {
//Save the file name in the database.
$presentation->asset = $fileName;
}
}
上述代码成功上传文件并将其放入目录中,然后继续将文件名保存在数据库中,但是文件损坏了。
上传test.txt文件时,上传成功,但在服务器上检查时,文件内容变为临时路径(见下)?????
/tmp/phpkTe9NX
谁能解释为什么会发生这种情况?我完全被难住了!
感谢您的帮助,
亚历克斯
【问题讨论】:
标签: php laravel file upload flysystem