bootstrap-fileinput uploadExtraData cant return data-nnn from the input field

Web Tips Q & ACategory: Krajee Pluginsbootstrap-fileinput uploadExtraData cant return data-nnn from the input field
mikecd asked 3 months ago

Hi,
First thanks a lot for this interesting plugin.
I try to get the data-filetype, from the input type file used to send the file to the server.
I set my input like :

<label class="control-label">My file</label>
<input id="filetype-3" name="filetype_3" type="file" class="file" data-filetype="3">

 

and I try use uploadExtraData (doc description) like this :
uploadExtraData: function() { return { userid: $("#id").val(), filetype: $(this).closest("input[name='t']").data('filetype'), tfile: 'ufile' }; }

But when the upload button is fired, $(this).closest(“input[name=’t’]”).data(‘filetype’) is always, and definitely undefined.
Any idea ?

Login or register to contribute or comment.

Login   Register