drewdan's avatar
Level 15

Uploading Large Files

Hey Guys, what would your approach be to upload a really large file? Say 500mb or larger?

I tried chunking the file, but I just cannot seem to piece the file back together properly as its always got corruption issues.

A colleague suggested uploading directly via axios to object storage. So I tried this using the S3Client class in Laravel. I use linode storage, so I have adjusted the various config items to accomodate for this:

	$s3Client = new S3Client([
			'region' => config('filesystems.disks.s3.region'),
			'version' => 'latest',
			'endpoint' => config('filesystems.disks.s3.endpoint'),
			'http_continue_timeout' => 0,
		]);


		$cmd = $s3Client->getCommand('GetObject', [
			'Bucket' => config('filesystems.disks.s3.bucket'),
			'Key' => 'andy.jpg',
		]);


		$request = $s3Client->createPresignedRequest($cmd, '+20 minutes');


		return (string) $request->getUri();

I create a signed URL using the above code, but when I try to use this URL in postman to upload a file to test, I get a SignatureDoesNotMatch error, and I just don't understand what I might be doing wrong. Any help would be most appreciated as I have been stuck here for a long while now :'(

0 likes
3 replies
drewdan's avatar
Level 15

Thanks for the link. If I am not mistaken, that would still require a post request of 500mb to the server and would require changes to the php.ini file too right? What I would ideally like is to stream directly to the object storage.

I will have a try and see what happens with this blog and see where we go from there.

Ta :)

drewdan's avatar
Level 15

I think this is going to be my best bet, and it seems to work well, changing the PHP ini file aside, but think I will just have to live with that. Ta!

Please or to participate in this conversation.