View Full Version : Issue with file upload form on Firefox

whirling dervish
11 Jan 2013, 9:02 AM
I am getting the following error in a simple file form under Firefox 18.

TypeError: result is undefined

The same code works fine under Chrome.

It looks like the issue is that the responseText is never set properly.

if (doc.body) {

// Response sent as Content-Type: text/json or text/plain. Browser will embed in a <pre> element
// Note: The statement below tests the result of an assignment.
if ((contentNode = doc.body.firstChild) && /pre/i.test(contentNode.tagName)) {
response.responseText = contentNode.innerText;

In this case contentNode.innerText is undefined.

The form contains a single filefield, and is submitted using the formPanel.submit method.

The response itself is,


"file": { "filename": "filename.json.gz", "content_type": "application/x-gzip", "uri": "http://localhost:9000/rest/files/50f0453de4b0b87cfb5ae4d2" }, "code": 201, "message": "Created", "success": true

So it has all the information extjs should need. Anyone have any idea what might be going on here?

13 Jan 2013, 9:20 AM
I just tried the file-upload.html example with 4.1.3 and it worked for me with FF 18 with this response:

{success:true, file:"foo.jpg"}

whirling dervish
14 Jan 2013, 9:34 AM
Hmm looking at the sample code I honestly don't know what is the difference between my code and the sample (http://dev.sencha.com/deploy/ext-4.0.0/examples/form/file-upload.js).

onSubmitClick: function(button, e, options) {
var me = this,
panel = me.getLoadPanel(),

loadingMask = new Ext.LoadMask(panel, {
msg: 'Loading, Please Wait...'
me.loadingMask = loadingMask;

scope: me,
success: me.createComparisonSet,
failure: me.formFailure

But based on the error I never get to process success.

EDIT: I tried adjusting the server response to match the one in the sample response, just to see if that was the issue. It isn't, I still get the same error regardless.

whirling dervish
15 Jan 2013, 4:11 PM
evant suggested a fix in my related bug report, http://www.sencha.com/forum/showthread.php?253640-4.1.3-Bug-in-code-paths-for-Ext.form.action.Submit-onSuccess&p=929590&viewfull=1#post929590

(http://www.sencha.com/forum/showthread.php?253640-4.1.3-Bug-in-code-paths-for-Ext.form.action.Submit-onSuccess&p=929590&viewfull=1#post929590)Changing the content type in the response from 'application/json' to 'text/html' fixed the issue.