Hi!
I'm trying to use kendoUpload through a Java servlet. Despite upload phase gets completed without a problem (that is, servlet receives and parses the input, and returns a successful JSON response with a page of type "text/plain") Kendo complains that unexpected server response. The strange thing is returned JSON response from the server looks ok, see below console output:
Server response: {"status":0,"data":[{"id":"4f11af83ccf2c8eb5e42afa8","text":"","type":"IMAGE","image":{"small":{"id":"4f11af83ccf2c8eb5e42afa7","width":100,"height":74},"large":{"id":"4f11af83ccf2c8eb5e42afa6","width":400,"height":296}}}]}
(I can also verify the above returned JSON from Firebug.) What might I be missing? How can I further diagnose the problem? (Using Kendo UI v2011.3.1129 GPL, Firefox 9.0.1) I reproduced the same error with "text/json" and "application/json" data types too.
BTW, I use kendoUpload as follows:
$(divSelect).html("<input id='input-4f11af83ccf2c8eb5e42afa7' type='file'/>");
$("#input-4f11af83ccf2c8eb5e42afa7").kendoUpload({
async: {
saveUrl: "/image/add",
saveField: "image"
},
upload: function(ev) { ev.data = {...}; },
success: function(ev) { ...; }
};
To further detail the problem, I introduced an error handler function to kendoUpload and placed a breakpoint right in the function body. Below is the stack trace at the breakpoint.
- ev: Object
- XMLHttpRequest: XMLHttpRequest
- onabort: null
- onerror: null
- onload: null
- onloadstart: null
- onprogress: null
- onreadystatechange: null
- readyState: 4
- response: "{"status":0,"data":[{"id":"4f11e39cccf21c6288c10834","text":"","type":"IMAGE","image":{"small":{"id":"4f11e39cccf21c6288c10833","width":72,"height":100},"large":{"id":"4f11e39cccf21c6288c10832","width":400,"height":558}}}]}"
- responseText: "{"status":0,"data":[{"id":"4f11e39cccf21c6288c10834","text":"","type":"IMAGE","image":{"small":{"id":"4f11e39cccf21c6288c10833","width":72,"height":100},"large":{"id":"4f11e39cccf21c6288c10832","width":400,"height":558}}}]}"
- responseType: ""
- responseXML: null
- status: 200
- statusText: "OK"
- upload: XMLHttpRequestUpload
- onabort: null
- onerror: null
- onload: null
- onloadstart: null
- onprogress: null
- __proto__: XMLHttpRequestUpload
- withCredentials: false
- __proto__: XMLHttpRequest
- files: Array[1]
- isDefaultPrevented: function (){return f}
- operation: "upload"
- preventDefault: function (){f=!0}
- __proto__: Object
- this: d.extend.init
In the above output, I dunno what
responseType actually corresponds to, but in the Firebug output I can verify that the server response is of type "text/plain".
Best.