简体   繁体   English

直接将大文件上传到Amazon S3,并使用Web表单和PHP将其他日期添加到数据库

[英]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. 我想创建一个单个Web表单,其中用户提供一个大文件,以及一些信息,例如标题和描述。 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. 提交表单后,应将文件直接上传到Amazon S3(而不是将其上传到Web服务器),同时使用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). 我将在S3上实现文件的Ajax提交(最终使用直接上载参数),然后在第二步中将所有其他字段提交到您的Web服务器(当然,甚至不是Ajax)。

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. 您还可以在表单中使用一个隐藏字段来提交新的S3链接(您可以在ajax上传完成后检索该链接),因为我想您需要将其与所有其他数据一起存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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