LPology / Simple-Ajax-Uploader

Javascript file upload plugin with progress bar support. Works in all major browsers, including IE7+, Chrome, Firefox, Safari, and Opera. No dependencies - use it with or without jQuery.
995 stars 267 forks source link

Upload failed: 200 OK #82

Closed NeoCortex3 closed 8 years ago

NeoCortex3 commented 9 years ago

The following code triggers onError and returns: filename.jpg-parseerror-200-OK-false and no file is uploaded even the progressbar works.

I just don't get it, did i miss any server-configuration?

Best regards NeoCortex.

$(function() { var sizeBox = document.getElementById('sizeBox'), // container for file size info progress = document.getElementById('progress'); // the element we're using for a progress bar

var uploader = new ss.SimpleUpload({
      button: 'upload-btn', // file upload button
      url: '/apicer/ajaxuploader/Uploader.php', // server side handler
      name: 'uploadfile', // upload parameter name        
      progressUrl: '/apicer/ajaxuploader/uploadProgress.php', // enables cross-browser progress support (more info below)
      allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
      maxSize: 8192, // kilobytes
      multiple: false,
      debug: true,
      responseType: 'json',
      onSubmit: function(filename, extension) {
          this.setFileSizeBox(sizeBox); // designate this element as file size container
          this.setProgressBar(progress); // designate as progress bar
        },         
      onComplete: function(filename, response) {
          if (!response) {
              alert(filename + ' upload failed');
              return false;            
          }
          alert(response);
          // do something with response...
        },
      onError: function(filename, errorType, status, statusText, response, uploadBtn) {
        alert(filename+'-'+errorType+'-'+status+'-'+statusText+'-'+response);
      }

});

});

ingro commented 9 years ago

What response are you sending from the server? Seems like it's not a valid json.

2Fwebd commented 8 years ago

@NeoCortex3, have you find out your issue ? I have the same issue :/

Thanks :)

NeoCortex3 commented 8 years ago

@2Fwebd No I wasn't able to fix it and lost interest.

2Fwebd commented 8 years ago

Hi, thanks for getting back ;)

I've fixed it, it was an issue in the json content from the server side. It was not valid JSON..just that ;)

2F