Upload large files to Amazon S3 directly and add o

2019-09-14 23:56发布

I want to create a single web form where a user provides a large file, and some information like title and description. When the form is submitted, the file should be directly uploaded to Amazon S3 (without uploading it to the web server), while the information is added to the database using PHP.

How would I go about doing this? I know I could use the direct upload post solution, but then I wouldn't be able to add the other information to the database.

1条回答
男人必须洒脱
2楼-- · 2019-09-15 00:08

I would implement an ajax submit of the file on S3 (using the direct upload parameters, eventually) and then submit all the other fields to your webserver in a second step (even not ajax, of course).

You could also use an hidden field in your form to submit the new S3 link (which you can retrieve after the ajax upload is completed), since I guess you need to store it together with all the other data.

查看更多
登录 后发表回答