【发布时间】:2018-08-25 19:06:54
【问题描述】:
我正在尝试上传视频,并且我的数据库中正确存储了路径,但我没有在我想要的文件夹中获得视频。
这是我的代码:
$postvideo = Postmedia::where('post_id',$id)->where('type','video')->first();
if (isset($postvideo))
{
if ($request->video_link) {
$postvideo->path = $request->video_link;
$postvideo->typevid = $request->link;
}
else
{
File::delete($postvideo->path);
if($request->hasFile('video_link_local'))
{
$file = $request->file('video_link_local');
$filename = $file->getClientOriginalName();
$path = 'uploads/post/';
$file->move($path, $filename);
$postvideo->path = $path.$filename;
$postvideo->ext = ($request->video_link_local)->getClientOriginalExtension();
$postvideo->typevid = $request->local;
}
}
$postvideo->save();
}
现在可以上传了,但是在强调文件名的情况下,我在这一行遇到了问题,文件名被更改了
$file->move($path, $filename);
例如:Présentation -> Présentation !!! 因此,当我想显示上传的视频时,这会产生问题
【问题讨论】:
-
什么是“我想要的文件夹”?我假设 /storage/app
标签: laravel file file-upload