View comments | RSS feed

onIOError (FileReference.onIOError event listener)

onIOError = function(fileRef:FileReference) {}

Invoked when an input/output error occurs.

This listener is invoked when the upload or download fails for any of the following reasons:

Important: Only Flash applications that are running in a browser -- that is, using the browser plug-in or ActiveX control -- can provide a dialog to prompt the user to enter a user name and password for authentication, and then only for downloads. For uploads that use the plug-in or ActiveX control, or that upload and download using either the standalone or external players, the file transfer fails.

Availability: ActionScript 1.0; Flash Player 8

Parameters

fileRef:flash.net.FileReference - The FileReference object that initiated the operation.

Example

The following example traces a message when the onIOError event is triggered. For simplicity, none of the other event listeners are included in this example.

import flash.net.FileReference;

var listener:Object = new Object();

listener.onIOError = function(file:FileReference):Void {
    trace("onIOError");
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.download("http://www.macromedia.com/NonExistentFile.pdf", "NonExistentFile.pdf");


Version 8

Comments


No screen name said on Feb 2, 2006 at 2:03 AM :
I have a question, i have made a simple swf with filereference.download. When i test this swf on y local machine i can download the image. But when i test the swf on a test server i get a onIOError. I have read the reasons for the Error but none of them applies to my problem.

The swf is found at http://www.fiertest.nl/test/testdownloadsize.html

Here is the code:
import flash.net.FileReference;

System.security.allowDomain("http://www.fiertest.nl");

var listener:Object = new Object();
this.txtStatus.htmlText = "File start";
var myRoot = this;
listener.onSelect = function(file:FileReference):Void {
trace("onSelect: " + file.name);
myRoot.txtStatus.htmlText += "onSelect " + file.name + "<br>";
}

listener.onCancel = function(file:FileReference):Void {
trace("onCancel");
}

listener.onOpen = function(file:FileReference):Void {
trace("onOpen: " + file.name);
myRoot.txtStatus.htmlText += "onOpen " + file.name + "<br>";
}

listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
myRoot.txtStatus.htmlText += "onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal + "<br>";
}

listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
myRoot.txtStatus.htmlText += "onComplete " + file.name + "<br>";
}

listener.onIOError = function(file:FileReference):Void {
trace("onIOError: " + file.name);
myRoot.txtStatus.htmlText += "onIOError " + file.name + "<br>";
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);

mcDown.onRelease=function(){
var url:String = "http://www.fiertest.nl/test/image.jpg";
if(!fileRef.download(url, "image.jpg")) {
trace("dialog box failed to open.");
}
};

Hope some one can help me with this strange issue.

With regards Ronald
No screen name said on Apr 7, 2006 at 3:24 AM :
I have the same problem, uploading works fine, but it won't download. It triggers the onIOerror listener like in your case.

Have you managed to solve this?
No screen name said on Sep 11, 2006 at 10:23 AM :
It isn't clear to me how to find out the actual cause of the ioError. It can be caused by 4 different things, but no error object is passed through to the listener.
lmanca said on Nov 10, 2006 at 7:15 AM :
We actually experience problems with FileReference.upload function using an HTTPS connection.
We get an I/O error when submitting the upload and this happens only with the plugin version of the Flash Player (Netscape 1.7, Firefox 1.x & 2.0)...
Does anyone have been using this function successfully ? and how ?
No screen name said on Jan 29, 2007 at 3:03 PM :
I have experience IOErrors when the upload url is incorrect. for example:

prefix = "http://someuploadlink/"
url = prefix + "?name="+escape(name.text)+"&email="+escape(email.text);

a fix would be this:
prefix = "http://someuploadlink/"
url = escape( prefix + "?name="+name.text+"&email="+email.text );
Dronecorp said on May 7, 2007 at 12:54 PM :
Trying to upload a file 0 bytes in size will result in an IOerror. Just so you know!

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002217.html