Laravel 不上传视频文件并将 tmp 文件名存储在数据库中
我正在使用 Laravel 5.8,我想上传一个视频文件。
因此,在控制器中,我添加了执行上传的代码:
if ($request->file('prd_video')) {
$video = Request::file('prd_video');
$videoname = $video->getClientOriginalName();
$path = public_path().'/upload/video/products/';
$request->file('prd_video')->move($path, $videoname);
$findpro = Product::find($stored->prd_id);
$findpro->prd_video = $videoname;
$findpro->save();
}
现在,当我对此进行测试时,加载几分钟后,文件不会上传,并将像 /tmp/phpsMPjG1
这样的名称存储在数据库。
而且没有出现错误,插入过程似乎已成功完成。
那么这里出了什么问题呢?我该如何解决这个问题?
I'm working with Laravel 5.8 and I wanted to upload a video file.
So in the Controller, I added this code which does the uploading:
if ($request->file('prd_video')) {
$video = Request::file('prd_video');
$videoname = $video->getClientOriginalName();
$path = public_path().'/upload/video/products/';
$request->file('prd_video')->move($path, $videoname);
$findpro = Product::find($stored->prd_id);
$findpro->prd_video = $videoname;
$findpro->save();
}
Now when I test this, after minutes of loading, the file does not uploaded and store a name like /tmp/phpsMPjG1
as filename in the database.
Also there is no error appearing and the process of insertion seems to be completed successfully.
So what's going wrong here? How can I solve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:关于AWS-SDK-PHP版本的上一个答案是不正确的。
edit: previous answer about version of aws-sdk-php was not right.