Laravel 5.8: The file was not uploaded due to an unknown error

  file, laravel, laravel-5.8, php

I’m working with Laravel 5.8 and I want to upload two videos, so I coded this at the Controller:

if ($request->file('prd_video') AND $request->file('prd_video_preview')) {
   $video = Request::file('prd_video');
   $videoname = $video->getClientOriginalName();
   $path = public_path().'/upload/video/products/';
   $moved = $video->move($path, $videoname);
   $video_preview = Request::file('prd_video_preview');
   $videoname_preview = $video_preview->getClientOriginalName();
   $path_preview = public_path().'/upload/video/products/preview/';
   $moved_preview = $video->move($path, $videoname_preview);
}

But now I get this error:

#message: "The file "name.mp4" was not uploaded due to an unknown error."

So what’s going wrong here? How can I solve this issue?

Source: Laravel

Leave a Reply