Laravel 损坏的文件 - 文件包含临时路径?

Laravel Corrupted Files - Files contain temporary path?

我目前正在使用 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

谁能解释一下为什么会发生这种情况?我完全被难住了!

感谢您的帮助,

亚历克斯

啊哈!结果我需要在 Storage::put() 函数上使用 file_get_contents($asset)。现在一切都说得通了! :)