alihoushyaripour's avatar

What is the best way for upload image and video?

Hi,

I'm coding an application similar Instagram and it's important for me to images and videos upload streamlined and optimized.

I read and search a little, the best way I found was 'intervention/image' library, but I feel there is a better way or there is a better library that is specially for uploading photos, videos and files that I do not know it.

Is there someone to help me?

Best regards <3

0 likes
2 replies
pardeepkumar's avatar

For Controller

public function upload(Request $request)
    {

        if(Request::hasFile('file')){

            $file = Request::file('file');
            $filename = $file->getClientOriginalName();
            $path = public_path().'/uploads/';
            return $file->move($path, $filename);
        }

For Images and videos php.ini files contains some limits that might affect this.


upload_max_filesize = 10M
post_max_size = 10M
memory_limit = 32M

For more information https://www.cloudways.com/blog/laravel-multiple-files-images-upload/

1 like

Please or to participate in this conversation.