为FineUploader中的每个文件提交多个表单字段 [英] Submit multiple form fields for each file in FineUploader

查看:58
本文介绍了为FineUploader中的每个文件提交多个表单字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法使fineuploader正常工作,包括提交其他表单元素.

I have managed to get fineuploader working fine, including the submission of other form elements.

我现在要求每个提交的文件都具有单独的表单元素. 如果您知道youtube的工作原理,那么您将看到每个视频如何获取其他表单字段,然后可以在视频仍在上传时进行填写.我可以毫无问题地处理提交的其他表单字段(如有必要,可以使用单独的ajax调用),但是如何将表单字段与其他文件相关联?

I now have a requirement to have separate form elements for each file that is submitted. If you know how youtube works, then you will see how each video gets additional form fields, then you can fill in while the video is still uploading. I can handle the additional form fields being submitted without any problems (using a separate ajax call if necessary), but how do I associate the form fields with the different files?

这有可能吗?

推荐答案

您有2个选项:

  1. 请等待,直到用户填写了文件特定的字段(或等待他们按下上传"按钮),然后在Fine Uploader实例上调用setParams方法(将参数作为对象传递) ,然后要求Fine Uploader上载文件.假定autoUpload选项设置为"false",并且您有一个启动上传的按钮,该按钮在上载程序实例上调用uploadStoredFiles方法.

  1. Wait until the user has filled out the file-specific fields (or wait until they press an "upload" button), call the setParams method on the Fine Uploader instance (passing the params as an object), and then ask Fine Uploader to upload the files. This assumes the autoUpload option is set to "false", and you have a button that starts that uploads which calls the uploadStoredFiles method on the uploader instance.

向您的Web应用程序添加逻辑,该逻辑可按需在Fine Uploader之外提交这些其他表单字段,假设您希望能够让用户在上传开始或完成后输入此数据.在这种情况下,您可以将文件的UUID(由Fine Uploader创建)与参数/表单值一起传递.精细上载器已经为每个文件以及每个上载请求发送了一个UUID,因此您需要跟踪此服务器端,以便将该文件与将来的请求连接起来.

Add logic to your web app that submits these additional form fields outside of Fine Uploader on demand, assuming you want to be able to have users enter this data after the upload has already started or completed. In that case, you can pass the file's UUID (created by Fine Uploader) along with the parameters/form values. Fine Uploader will already send a UUID for each file along with each upload request, so you will need to track this server-side in order to connect the file with your future request.

这篇关于为FineUploader中的每个文件提交多个表单字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆