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

喜欢而已 提交于 2019-12-11 15:43:54

问题


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:


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.



来源:https://stackoverflow.com/questions/13369143/upload-large-files-to-amazon-s3-directly-and-add-other-date-to-database-using-we

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!