fineuploader image uploads include caption with uploaded files -
i have legacy app has 5 separate file uploads single db record. beside each file upload there field enter caption uploaded file.
i considering replacing whole lot fineuploader gallery , allow ten files uploaded.
however, useful on old system have caption each image alt tag of image when comes web display.
i address multiple single file uploads using fineuploader , caption field each want away having many on page.
i see there option change file name during upload might option lead long/messy file names , may cause issues accents , other characters.
can suggest approach?
i suggest considering use built-in edit filename feature, seems appropriate me , simplest approach.
another approach involves following:
- add file input field fine uploader template. hold user-entered caption value. need css make appropriate project.
- initialize fine uploader
autoupload
option setfalse
. allow users enter in captions , upload files clicking button (to added later). - register
onupload
callback handler. here, read value of associated file's caption stored in text input , tie filesetparams
api method.
the file list portion of your template may this:
<ul class="qq-upload-list-selector qq-upload-list" role="region" aria-live="polite" aria-relevant="additions removals"> <li> ... <input class="caption"> </li> </ul>
and fine uploader code contain logic (important unrelated options such request.endpoint
, element
left out maintain focus on question):
var uploader = new qq.fineuploader({ autoupload: false, callbacks: { onupload: function(id) { var filecontainer = this.getitembyfileid(id) var captioninput = filecontainer.queryselector('.caption') var captiontext = captioninput.value this.setparams({caption: captiontext}, id) } } })
your server receive "caption" parameter associated value part of each file's upload request.
Comments
Post a Comment