Loading jquery file causes error

I have an ASP.NET MVC application. This application requires jQuery 2.1 due to other jquery plugins in the application. I am trying to provide the user with the ability to upload photos. In an attempt to do this, I watched the jQuery file downloader . My JavaScript looks like this:

$('#userPicture').fileupload({ dataType: 'json', done: function (e, data) { } }); 

UserPicture markup is as follows:

 <input id="userPicture" type="file" name="userPicture" data-url="/pictures/User/@ViewBag.UserId"> 

The page initially loads without errors. However, when I select a picture, I get an error message:

 Uncaught Error: no such method 'process' for fileupload widget instance jquery-2.1.1.js:250 

Image preview is not displayed. How can I select an image and show client-side preview through a jQuery plugin that works in IE 8+

+7
javascript jquery asp.net-mvc
source share
2 answers

From the specs I checked, jQuery 2.x supports IE9 +.

Source: http://jquery.com/browser-support/

So jQuery 2.1 does not support IE8.

If you use the jQuery plugin you mentioned, there is very little support for IE9 -:

  • You can upload only one file at a time.
  • You can load only the usual "file input".
  • No image preview.
  • Missing progress bar.
  • and etc.

If you support modern browsers (Firefox, Chrome, IE10 +):

  • You can drag and drop files.
  • You can upload multiple files.
  • You can view images.
  • You can see the download progress.
  • and etc.

Here is the full list:

https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support

You are most likely involved with jQuery 2.1 support for IE8.

Possible solutions:

1- use an older version of jQuery. You can use any jQuery 1.6+ with the jQuery file upload plugin (Source: https://github.com/blueimp/jQuery-File-Upload ). jQuery 1.x supports IE6 +, so it supports IE8.

2- (RECOMMENDED) get rid of IE8. Upgrade jQuery to the latest stable version. Use the latest jQuery file upload plugin. Provide a simple HTML download for IE8 users.

+2
source share

I had the same issue with Chrome, in my case the problem seems to be that the jquery plugin jquery.fileupload-process.js is missing, as @jevgenig mentioned in his comments. hope this can help someone

+25
source share

All Articles