问题
I have managed to get fineuploader working fine, including the submission of other form elements.
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?
Is this even possible?
回答1:
You have 2 options:
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 theautoUpload
option is set to "false", and you have a button that starts that uploads which calls theuploadStoredFiles
method on the uploader instance.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.
来源:https://stackoverflow.com/questions/18619601/submit-multiple-form-fields-for-each-file-in-fineuploader