1

I am working on uploading video file in laravel but the problem that it takes much time as it could reached to 2-3 minutes

This is the snippet of code

if($courseclass->video !="")
                    {
                        $content = @file_get_contents(public_path().'/video/class/'.$courseclass->video);

                        if ($content) {
                            unlink(public_path().'/video/class/'.$courseclass->video);
                        }
                    }

Do anyone has an idea about this , Thanks in advance

apokryfos
  • 38,771
  • 9
  • 70
  • 114

2 Answers2

2

You can use php's file_exists() method instead of file_get_contents()

Obsidian
  • 3,719
  • 8
  • 17
  • 30
0

You are using php main function which is file_get_contents this is probably the main cause. My suggestion is to use the default file upload feature from Laravel file system storage

This slow upload problem happened at file_get_contents very slow because it uses the basic function file_get_contents. Hopefully useful, thank you.