javascript - Dynamically adding files to a input -


I am using this plugin: (see demo), inside a form

I can create a input [type = "file"] , it can be hidden and dynamic. Add files uploaded to the plugin inside the input? it's possible?


So, if I can not do this, how can I upload files to the server with this plugin, when users click the submit button? I know this plugin is already doing with AJAX, but I want to upload only if the user clicks on a button.

Maybe I should have made a variable named a files and, when the user clicks the submit button then using AJAX to send files and other information to myself

Something like this:

  JQuery ("#dropbox"). Html5Uploader ({onClientLoadStart: function (event, file) {files [] = file; [...]}}); [...] jQuery ("#button"). On ("click", function () {jQuery.ajax ({data: files}); [...]});  

You can not do this for security reasons. Imagine just the prospects I enter a file by javascript in a hidden area. Submit you submit me your file Any file awesome, right?


Comments