PHP - Upload file to S3 Bucket using AWS4-HMAC-SHA256 Mumbai Server

2.7k views Asked by At

Currently I have working on System build by using which has been migrate from Godaddy to Amazon AWS. We have also use S3 Bucket for storing images or other file. Our Server location is Mumbai. Our system is working nicely on amazon, but I have facing problem in File upload to S3 Bucket.

I have follow this code for upload file to S3 Bucket Server. http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html.

But by using this code from form we can send only image or file directly upload to S3 Bucket.

But I have want to upload file to S3 Bucket via my php code not directly upload html form to S3 Bucket. Because with file or image we want to insert form data to mysql server also.

If anyone has some idea to how can we upload file to s3 bucket via php code with submitting form data also.

1

There are 1 answers

8
Thamilhan On BEST ANSWER

You can use Donovan Schönknecht's PHP class to upload it to S3. It can be cloned from this git.

You can process with your file/image before applying some object operations to push it to S3 bucket.


In addition, if you need to process your image before uploading it to bucket, you can use this repository that processes the images before uploading it to desired AWS S3 bucket