简体   繁体   中英

Upload large files to Amazon S3 directly and add other date to database using web forms and PHP

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM