user1074242
user1074242

Reputation: 15

Uploadifive jQuery Upload non-flash version

Im using the jQuery Upload library uploadify non flash version called uploadifive I got it install but a weird problem when you click on the browse / Select file button nothing happens has any else ran into this problem and if so how to fix thank. The HTML is basically simple just the upload input and a div tag



$(function() {
  $('#file_upload').uploadifive({
    'debug'             : true,
    'auto'              : true,
    'formData'          : {'test' : 'something'},
    'queueID'           : 'queue',
    'buttonText'        : 'ATTACH FILE',
    'uploadScript'      : '".base_application_url()."upload_license/',
    'onUploadComplete'  : function(file, data) {
    console.log(data);
     });
});

Upvotes: 1

Views: 5296

Answers (1)

Jim Buck
Jim Buck

Reputation: 2444

tl;dr

Change your code to this:

$(function() {
  $('#file_upload').uploadifive({
    'debug'             : true,
    'auto'              : true,
    'formData'          : {'test' : 'something'},
    'queueID'           : 'queue',
    'buttonText'        : 'ATTACH FILE',
    'uploadScript'      : '/upload_license',
    'onUploadComplete'  : function(file, data) {
      console.log(data);
    },
    'onFallback': function(){
      alert('HTML5 is not supported in this browser.');
    }
  });
});

Descriptions

I've been using Uploadifive and it has worked out great. Although their examples and documentation all use PHP, I have been using it with .NET just as easily.

The first issue I see with your code is the uploadScipt value, which is equivalent to the action attribute in an HTML form. I can see you're trying to get the absolute URL from ".base_application_url()."upload_license/, but you only need the relative URL, such as /upload_license or /upload_license.php. I am using it with .NET MVC4, so my uploadScript is set to /upload.

The other possibility is that your browser may not support the HTML5 version (could be outdated). For an easy test, add this options to when you initialize your uploader

'onFallback': function () {
    alert('HTML5 is not supported in this browser');
}

This code will display an alert if Uploadifive is not supported. If that is the case, download the flash version as well and initialize that in the onFallback callback.

Upvotes: 3

Related Questions