0

I want to upload multiple videos to their site and want to list them there. Please give me a solution to how can manage this.

I want to save it in the database so that could list on the site.

This is my code but not working proper consuming more time to upload and the page is expired

$this->validate($request, [
            'filename' => 'required',
            'file' => 'mimes:mp4,ts|max:100040|required'
        ]);

        dd($request->all());

        if ($request->hasFile('file')) {
            //upload file
            $file = $request->file('file');
            if(!empty($file) && $file != null)
            {
                $video_file = new VideoPost();                        
                $fileExentsion              = $file->extension();
                $fileName                   = $file->getClientOriginalName();
                $fileFullName               = time()."_".$fileName;
                $path                       = Str::slug($fileFullName).".".$fileExentsion;
                $file->move(public_path('files/'), $path);
                $fullpath                   = 'files/'.$path;
                $video_file->file = $fullpath;
                $video_file->file_name = $request->file_name;
                $video_file->save();
            }
        }
Shadow
  • 33,525
  • 10
  • 51
  • 64
Spiral
  • 917
  • 1
  • 9
  • 15
  • 1
    Perhaps your video files are too big and php cannot finish processing it within max execution time set in php.ini. – Shadow Jul 11 '21 at 07:48
  • @Shadow, How can I solve it because I want to upload multiple videos and save them in the database so that could list them in the website – Spiral Jul 11 '21 at 07:50
  • @Spiral here is the solution [change the maximum upload file size](https://stackoverflow.com/questions/2184513/change-the-maximum-upload-file-size) – DengSihan Jul 11 '21 at 08:44
  • @Spiral have you tried changing the max execution time as suggested above? – Shadow Jul 11 '21 at 09:33
  • @Shadow, Yes I have tried but I will upload videos that will more than 50MP or less – Spiral Jul 11 '21 at 10:44
  • @Spiral changing the max file size was also suggested... – Shadow Jul 11 '21 at 11:53
  • Dear, @Shadow I was changed the max file size but was not worked. Taking time for uploading the file and last give bytes error. I have both max size 200M – Spiral Jul 11 '21 at 17:01

0 Answers0