0

I am trying to upload videos using laravel, filepond and s3 bucket. When file size is greater than 5Mb aws is not returning anything and even the file is not getting uploaded. But when the file size is less than 5Mb it's getting uploaded and I am able to get the s3 file path.

public function upload_video(Request $request){
    if ($request->hasFile('link')) {
        $video_link = Storage::disk('s3')->put('videos', $request->file('link'));

        return $video_link;
    }
}
6
  • This sounds more like a file size limit of the web server or php - I'd start there. What do the laravel logs say? Which web server are you using (nginx, apache, etc.)? Commented Mar 5, 2022 at 16:24
  • For development i am using Apache(wampp) server but in production as i am using nginx Commented Mar 5, 2022 at 16:42
  • And also there are no logs Commented Mar 5, 2022 at 16:53
  • Ok - is this happening in both Dev and Prod? Have you checked the client_max_body_size for nginx? What does php have set for upload_max_filesize and post_max_size? Commented Mar 5, 2022 at 17:12
  • It's happening both dev and prod also I have increased upload_max_filesize, post_max_size still same issue Commented Mar 6, 2022 at 4:20

2 Answers 2

1
+50

Ensure PHP.INI settings were allowing uploads high enough. PHP.INI only allows 2M by default, so increased this limit to 20M. And Amazon S3 doesn’t like files over 5 MB uploading in one go, instead, you need to stream it through.

please use the given reference link to solve this issue by using streaming from server to S3.

https://www.webdesign101.net/laravel-s3-uploads-failing-when-uploading-large-files-in-laravel-5-8/

Sign up to request clarification or add additional context in comments.

Comments

0

If you want to upload big files you should use streams. Here’s the code to do it:

$disk = Storage::disk('s3');
$disk->put($targetFile, fopen($sourceFile, 'r+'));

1 Comment

It's not working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.