Download a file using blueimp

I am trying to upload a file using the blueimp file. I use very simple code for testing, but the code does not work. There are two errors in the firefox error console

  • Error: TypeError: $ .ajaxTransport is not a function

  • Error: TypeError: $ .support undefined

Here is my code

<input id="fileupload" type="file" name="picture"/> <input type='button' id='sub'/> $('#sub').click(function () { $('#fileupload').fileupload({ url: 'php/index.php', // dataType: 'json', done: function (e, data) { $.each(data.result.files, function (index, file) { $('<p/>').text(file.name).appendTo(document.body); }); } }); }); 

And after clicking the button, another error occurred

  • Error: TypeError: $ (...). fileupload is not a function

    This means that the plugins function is not working. Please inform in advance, please.

+4
source share
2 answers

So, I'm pretty new to jquery, but I had the same errors trying to use the same plugin. I looked at ajaxTransport and found that it was actually a function in jquery, which gave me a pretty good guess that I was using an old version of jquery. Of course: VS2010 does not update its jquery, so if you create a new project in VS, you get jquery-1.4.1. Now jquery to version 1.10.0. Updated my project to this version, the errors went away, and my server code was called successfully.

+1
source

Press F12 in your browser and look at the network tab to see which scripts load when your page refreshes. In my case, I downloaded jquery twice, deleting one of them, fixed the problem for me.

0
source

All Articles