Ticket #2531308 (closed defect)

Reporter


Andrew Niema
Opened: 10/15/11
Last modified: 04/17/12
Status: closed
Type: defect
Resolution: fixed

Owner


Thomas S. Sha
Target Release: 3.5.0
Priority: P3 (normal)
Summary: File Upload is not working
Description:

When trying to upload a file using IO module FireBug lists an error:
"l.c.abort is not a function"

Tested on FF 7.0.1 and IE 9 both for Windows.

Type: defect Observed in Version: 3.4.1
Component: IO Severity: S3 (normal)
Assigned To: Thomas S. Sha Target Release: 3.5.0
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: IE 9.x,Other
URL:
Test Information:

Using below example I excpected to see alert box either "succ" of "fail". No alert is popping at all.
Instead Firebug displays "l.c.abort is not a function" error. Similar message pops up in IE 9, asking to debug or not.

Test case:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
</head>

<body>
<form action="" method="post" id="formA"><input name="fileA" type="file" /><input name="" type="text" /></form>
<script type="text/javascript">
var yui1=YUI().use("io-upload-iframe", function(Y) {
var cfg = {
on: {
success: function(id, o, args){ alert("succ"); },
failure: function(id, o, args){ alert("fail"); }
},
sync: true,
context: this,
timeout: 10000,
method:"POST",
form: { id:"formA",upload: true }

};
Y.io("http://10.0.0.1/", cfg);
});

</script>

</body>
</html>

Change History

Thomas S. Sha

YUI Contributor

Posted: 10/17/11
  • priority changed to P3 (normal)
  • status changed from new to infoneeded

Synchronous mode is not supported when uploading files. I suspect this configuration is triggering the error.

Andrew Niema

Posted: 10/18/11
  • status changed from infoneeded to assigned

Hi,

No, with "sync:false" that error remains the same.

Andrew Niema

Posted: 10/18/11

I have a working app on 3.3.0, which uploads files, and it stopped working on 3.4.
After trying to nail the problem I tried this simple example - not working either.

Thomas S. Sha

YUI Contributor

Posted: 10/18/11
  • status changed from assigned to infoneeded

Please see http://yuilibrary.com/projects/yui3/ticket/2530999 and confirm the report is applicable for 3.4.1 and not 3.4.0; I cannot reproduce the error when testing against 3.4.1.

If you are able to reproduce this error in 3.4.1, please provide a complete and functional example that demonstrates this condition. The test case you provided is not a functional example.

Andrew Niema

Posted: 10/18/11
  • status changed from infoneeded to assigned

ok, my problem was it was "sync:true", and I didn't see any note in user guide, that this is not allowed.

The test case I provided is using "success" and "failure" events which are not fired in file upload using iframe (I forgot that), and they caused that error no matter sync was true of false.
When changed those events to "start" and "complete" AND sync:false the error doesn't occure.

Please update the user guide so other people won't fall in the same hole and maybe save some time.

Andrew Niema

Posted: 10/18/11

BTW - in 3.3.0 i am using sync:false, and correct events, AND it still throws this error when changed to 3.4.1.
Ok, I have to look at it more deeply.
I think this case is closed.

Thomas S. Sha

YUI Contributor

Posted: 10/18/11
  • status changed from assigned to closed

Thomas S. Sha

YUI Contributor

Posted: 10/18/11
  • resolution changed to invalid

Please have a look at the section on uploading files using IO: http://yuilibrary.com/yui/docs/io/#uploading-files-in-an-html-form

Here, it specifically states that for file uploads, the event cycle is: Start, Complete, End.

Feel free to reopen this ticket when you have additional reproduction data.

jack chan

Posted: 10/25/11
  • resolution changed from invalid
  • status changed from closed to reopened

I am getting this same error when using TIMEOUT and io-upload-iframe

Test case:


<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
</head>

<body>
<form action="" method="post" id="formA"><input name="fileA" type="file" /><input name="" type="text" /></form>
<script type="text/javascript">
var yui1=YUI().use("io-upload-iframe", function(Y) {
var cfg = {
on: {
success: function(id, o, args){ alert("succ"); },
failure: function(id, o, args){ alert("fail"); }
},
timeout: 10000,
method:"POST",
form: { id:"formA",upload: true }

};
Y.io("http://10.0.0.1/", cfg);
});

</script>

</body>
</html>

jack chan

Posted: 10/25/11

Also, I get the error even if I don't specify any event callbacks.

Thomas S. Sha

YUI Contributor

Posted: 10/25/11
  • status changed from reopened to infoneeded

The test case does not show how the upload is actually being triggered. (The test case you provided is nearly a duplicate of the original submission.)

Additionally, the success and failure events are not fired for file uploads. Per my comment on 18, October, the event cycle is: start, complete, end.

It would be easier if you can direct me to a production example that demonstrates the reported issue.

Andrew Niema

Posted: 10/30/11
  • status changed from infoneeded to assigned

ok, let's get back to my case (sorry Jack) :)

Thomas, please take a look at this example:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
</head>

<body>
<form action="http://10.0.0.5/" method="post" id="formA"><input name="fileA" type="file" /><input name="" type="text" /></form>
<script type="text/javascript">
var yui1=YUI().use("io-upload-iframe", function(Y) {
var sendForm=function(forma, completeFunkcja){
var cfg = {
on: {
complete: completeFunkcja
},
method:"POST",
sync: false,
form: { id:forma,upload: true },
timeout: 10000
};

Y.io(Y.one('#'+forma).get('action'), cfg);
};

sendForm("formA",function(id, o, args){
alert("event");
});
});

</script>

</body>
</html>

Now, when it's run, the complete event does fire, alert is popping up, but the "l.c.abort is not a function" comes up too. This error breaks further code execution.
But when switched to YUI 3.3.0 everything is OK.

Andrew Niema

Posted: 10/30/11

I can confirm what Jack Chan said - then TIMEOUT is removed, this error stops occuring.

Thomas S. Sha

YUI Contributor

Posted: 10/31/11
  • status changed from assigned to accepted

Thank you. I can confirmed the reported behaviour.

Thomas S. Sha

YUI Contributor

Posted: 11/1/11

The startTimeout and clearTimeout functions between io-base and io-upload-iframe are colliding; the io-upload-iframe module is using the wrong functions.

Thomas S. Sha

YUI Contributor

Posted: 11/1/11
  • location changed to Library Code
  • milestone changed to 3.5.0

Thomas S. Sha

YUI Contributor

Posted: 11/1/11

The startTimeout and clearTimeout functions between io-base and io-upload-iframe are colliding; the io-upload-iframe module is using the wrong functions.

Thomas S. Sha

YUI Contributor

Posted: 11/1/11
  • status changed from accepted to checkedin

Thomas S. Sha

YUI Contributor

Posted: 11/8/11

Ticket #2531370 was marked as a duplicate of this ticket.

Thomas S. Sha

YUI Contributor

Posted: 03/29/12

Ticket #2532068 was marked as a duplicate of this ticket.

Jenny Donnelly

YUI Developer

Posted: 04/17/12
  • resolution changed to fixed
  • status changed from checkedin to closed

Closing out bugs checked in to 3.5.0.