Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.

Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.

This error can be caused for a variety of reasons. In most cases the server is rejecting the request. When Flash get the response from the server.

– incorrect path to the upload file script – check relative and absolute paths
– a incorrect location for the files to be stored on the server specified inside server-side upload script – check path is correct and permissions are correct
– file is too large so server rejects it – check max file size
– there is no space on the server to save the file – check server hard drive space
– your actionscript handler is going out of scope because it’s declared locally,
etc – create a strong event listener or declare the file reference on the class

It is closely related to this error.

// incorrect url (no file named upload1.php)
request = new URLRequest("http://www.somesite.com/upload1.php")
// correct url
request = new URLRequest("http://www.somesite.com/file_upload.php")

try {
	// upload file
	fileRef.upload(request);
	textarea1.text = "uploading " + fileRef.name + "...";
}
catch (error:Error) {
	trace("Unable to upload file.");
}

More answers are in the comments…

Please reply in the comments below if this helped you or not. You can also use the Error Lookup to look up Flex compiler or runtime errors.

Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.

46 thoughts on “Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.

  1. I have a really strange error like this, hopefully you guys have a pointer to why.

    I have a upload flex page that works great with any osx machine that I use (safari and firefox) but throws a 2038 error when using any windows machine (opera and IE)..

    Has anyone seen such an error? and if so, any ideas on the fix would be really apprecialted.

    Thanks
    Blake

    Like

  2. I want to add the clarification for the possible reason of Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.

    Even if the server-side upload script is located at the server at the correct location, this Error#2038 can still happen inside Flash player.

    The reason for this can be a WRONG location for the files to be stored on the server specified inside server-side upload script.

    Inside IE and Firefox the behavior under Flash player during file uploads differs, it definitely worth an effort to test file upload independently under all target browsers

    Like

  3. Taher Mestiri says:

    I would like to add an information about the IO Errors that it can be caused by ModSecurity module in Apache and throws back a 406 http not acceptable error. to get it solved you can add .htaccess file to the script directory and to the destination folder for the file transfer that includes the following:

    SecFilterEngine Off
    SecFilterScanPOST Off

    this will disable the ModSecurity module for that folder.

    Like

  4. Jesus says:

    Taher Mestiri, man you saved my life with this :

    SecFilterEngine Off
    SecFilterScanPOST Off

    Thanx! Thanx! Thanx! Thanx! Thanx! Thanx! Thanx! Thanx! Thanx!

    Like

  5. Likewise, Taher Mestiri, you have saved me as well. I’ve been pulling out my hair trying to figure out why everything works fine on my local server, then falls apart with 2044 and 2038 errors on my web server.
    Thanks a bunch.

    Like

  6. mani says:

    I’m sorry… I don’t know what this mean.
    Anybody could told me how to do this?
    I can’t creat a file names .htaccess in windows vista~~
    Thanks ~~
    I would like to add an information about the IO Errors that it can be caused by ModSecurity module in Apache and throws back a 406 http not acceptable error. to get it solved you can add .htaccess file to the script directory and to the destination folder for the file transfer that includes the following:

    SecFilterEngine Off
    SecFilterScanPOST Off

    Like

  7. Is there an equivalent for the ModSecurity error on ASP servers? I’m using Flash to send the file & some additional POST variables to an ASP script on the server. The ASP script functions fine when we submit to it using an HTML form, but if I use Flash, I get the “Error #2038: File I/O Error”.

    Also thinking about JabbyPanda’s wrong file location in the server script, is it possible that the script would work fine with an HTML form but not with a Flash one?

    Thanks!

    –eric

    Like

  8. Also, just to add an additional bit of fun to the mix, the upload works fine on PC running Internet Explorer and/or FireFox, but throws the IO error on Mac running FireFox and/or Safari.

    Any ideas anyone?

    Like

  9. Fahad says:

    Since this error has been arond for quit a while is there indication when Adobe will get to fixing this seemingly easily to fix but a very difficult to debug problem?

    Like

  10. Fahad says:

    I tried having an htaccess file with the directives as given but it is still not working. Rather the entire folder is giving a 500 error. Apache logs contain the following entry

    Invalid command ‘SecFilterEngine’, perhaps misspelled or defined by a module not included in the server configuration

    Can anyone help me here?

    –Fahad

    Like

  11. Ken Boyd says:

    I am talking about Flex & Java as backend using Tomcat server.

    1. If you have size issues make sure you create “temp” directory under tomcat/temp

    2. If you should use apache commons-fileupload which is piece of cake to use

    // Create a factory for disk-based file items
    FileItemFactory factory = new DiskFileItemFactory();

    // Create a new file upload handler
    ServletFileUpload upload = new ServletFileUpload(factory);

    // Parse the request
    List items = upload.parseRequest(request);

    // Process the uploaded items
    Iterator iter = items.iterator();

    while (iter.hasNext()) {
    FileItem item = (FileItem) iter.next();
    if (item.isFormField()) {
    // parse normal field values
    } else {
    File uploadedFile = new File(realPath+fileName);
    item.write(uploadedFile);
    }
    }

    Above code is for servlet (just add post or get method definition to get going.

    Also make sure you use correct url e.g. http://localhost:8080/blazeds/Upload, where “Upload” is mapped in web.xml as following

    CaseFileUpload
    com.bugger.server.CaseFileUpload

    CaseFileUpload
    /Upload

    Hope it will help someone.

    Like

  12. I also have had the Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error. The problem for me was that some of the file names had apostrophes in them such as when I went to upload a song like

    The Who – Baba O’Reilly.mp3

    When I removed the apostrophe then no error. Hope this might help some out.

    Jim

    Like

  13. Leonidas says:

    I ran into this error too, and solved it by realizing i had defined a proxy server for IE7 the day before. Once i disabled the proxy usage, magical, it worked. Pain.

    Like

  14. Greg says:

    I am using Rails to process uploaded images and was getting this error when testing on IE/WIndows. I fixed it by using an XML response instead of text/html.

    Like

  15. Zahid Riaz says:

    Guys! what i found is flash/flex takes session settings of IE and does not read the session of firefox, that is why people using firefox got error# 2038. Try following steps and you will probably get the scenario

    1. Login using IE browser.
    2. Now login thorugh firefox (Do not close IE session)
    3. upload file. it will work fine.
    4. Logout from IE only.
    5. upload file through firefox. Error will appear.

    I tried it many times with different combinations and every time got the same result.

    If this is the real problem then may be some guy can give a solution.

    Like

  16. Adrian Thomson says:

    Zahid – thanks for this. I’ve been pulling my hair out trying to work out why the upload from a flex app on firefox failed with the I/O Error, yet the same upload from a html form worked fine. Opened IE, altered proxy settings to add *.local to exceptions, retried, and it worked fine. Bit of a PITA if you use firefox as your browser and hardly use IE. Moral of the story is make sure your IE is set up properly even if you never use it…

    There may be more to this – maybe someone who knows how the flash player interacts with the browser/system/environment may be able to provide more details on what settings are used and how to change them?

    Like

  17. Marceu says:

    Adobe/Macromedia = crap.

    I can’t seem to resolve this bug.

    It’s happening both with php and java.

    How come it return an error like that w/o telling the cause.

    Like

  18. Taher Mestiri says:
    February 19, 2008 at 10:09 am

    I would like to add an information about the IO Errors that it can be caused by ModSecurity module in Apache and throws back a 406 http not acceptable error. to get it solved you can add .htaccess file to the script directory and to the destination folder for the file transfer that includes the following:

    SecFilterEngine Off
    SecFilterScanPOST Off

    this will disable the ModSecurity module for that folder.

    Thanks Taher Mestiri . it is solved the error , now upload working fine.

    Like

  19. My experience about this error is with swfupload,

    testing on any server local or production. (mampp local, dreamhost on production)
    No matters the plugin version.

    I was testing the website in firefoxeverything was working fine but upload.
    tried with safari.
    safar unable to connect..
    unchecked prosy settings in safari.
    back to firefox

    upload succesful.

    no more error #2035

    Like

  20. Vamsi says:

    Pam,

    I still face this error when i send csv data to a servlet through the request which read from request and sends it to response stream.

    I am facing below error when the data is greater than 1MB.

    ERROR:#2038 File I/o Error. URL

    Like

  21. Vamsi says:

    Pam,

    I still face this error when i send csv data to a servlet through the request which read from request and sends it to response stream.

    I am facing below error when the data is greater than 1MB.

    ERROR:#2038 File I/o Error. URL

    Can you explain me how exactly you fixed this problem.

    Like

  22. Cathal says:

    This is why Actionscript is sh*t, full of bugs and errors which have completely vague and generic error codes which making it incredibly awkward and tedious to resolve any issues. This is why I’m dumping flash for good. Adobe I can’t wait till you disappear off the face of the planet!!!

    Like

  23. sevense says:

    Zahid Riaz , you are right , i got the same result so how to solve ?

    1. Login using IE browser.
    2. Now login thorugh firefox (Do not close IE session)
    3. upload file. it will work fine.
    4. Logout from IE only.
    5. upload file through firefox. Error will appear.

    by the way i added .htaccess
    SecFilterEngine Off
    SecFilterScanPOST Off

    in uploaddir and it works with uploading any size without getting
    i/o error but failed with downloading the file .

    Like

  24. Joakim says:

    This error (#2038) seems to be very random (various platforms, various OS etc etc). I can one day get the error while uploading a file while it goes without errors the other. This error seems to have been in flash for ages without Adobe doing anything to fix it. I’m following Cathal and leaving Flash behind, just as S. Jobs have done with Apple.

    Like

  25. greg says:

    I was referred to your blog by Flex harUI in the Adobe forum for this issue. Unfortunately, this is the same result as the rest of the web. I’ve almost reached the end of the internet hunting this, and I’ve definitely reached the end of my wits.

    1. in Air, FileReferenceList doesn’t objects in fileReferenceList do not fire the complete event when doing fileList[i].load(). In a Flex project it works fine. Flex SDK 4.1.

    Result: rewrite this part o the Air app in Flex, hosted in an HTML component.

    2. FileReferenceList randomly gets #2038 from upload() process. I’ve ensured proper variable scope in client and web.config server settings; .Net 3.5 using either an httpHandler or a standard .aspx processing page.

    Result: load fileReferenceList.fileList into an arrayCollection along with a status variable to retry files that the get 2038’s.

    Would be glad to post code, but if it doesn’t really resolve the issue, I feel I’d just be leading others down another rabbit hole.

    Like

    1. Judah says:

      Greg, I think you’ll find the answers in the comments. It could be caused for a variety of reasons. It comes down to the server either rejecting the file upload for some reason and any condition that causes Flash to not get the response from the server.

      – The reason for this can be a WRONG location for the files to be stored on the server specified inside server-side upload script.
      – Wrong location to the upload file script
      – File is too large so server rejects it
      – there is no space on the server to save the file
      – your actionscript handler is going out of scope because it’s declared locally,
      etc

      Like

  26. Shadaksharayya H A says:

    I used FireFox Browser and got flex error saying “Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.” when uploading a file using FileReference.upload(). I captured tcpdump and found that it was due to ISA HTTP proxy returning error “HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )”.
    Eventhough FireFox is configured with ISA proxy username and password this error was seen. Which means flex FileReference object doesn’t use the proxy username and password setting configured in firefox.

    I tried the same upload with same proxy settings from IE and it worked fine.

    Like

  27. Shadaksharayya H A says:

    One difference is observed between the way HttpService and FileReference when HTTP requests is sent with HTTP proxy is configured.

    Flex HttpService : First HTTP request is made without proxy auth headers. When it fails with “HTTP/1.1 407 Proxy Authentication Required” second request is sent with Proxy-Authorization: Negotiate header and this succeeds.

    Flex FileReference : One HTTP request is made without proxy auth headers. When it fails with “HTTP/1.1 407 Proxy Authentication Required” second request is not sent with Proxy-Authorization: Negotiate header.

    Like

    1. Judah says:

      Sunil – you can use the code below to find the correct path to the local HTML file:

      			public var localPage:String = "app:/blank.html";
      			private function getPage(page:String):String {
      				return new File(new File(page).nativePath).url;
      				// heavy duty version - using String for things like ensuring one item XMLLists resolve to String
      				//return new File(new File(decodeURI(page)).nativePath).url;
      			}

      Like

  28. Avipriya Sharma says:

    IO error in Firefox bcoz flash/flex takes session settings of IE and does not read the session of firefox. So you need to some piece of code just below in web.config of your ASP.Net project:

    Like

    1. Avipriya Sharma says:
      <location path="Upload.aspx">
         <system.web>
           <compilation debug="false" />
      	<authorization>
      	  <allow users="*"/>
      	</authorization>
      	<customErrors mode="Off"/>
         </system.web>
      </location>

      Like

  29. Hello,

    I have a strange error like this on a problem , the upload works fines on windows (firefox, ie, chrome, safari) but fails on safari mac (but only on somes macs , very strange)

    I dunno what to do.. the path of the upload script is ok and I dont have mod security enabled (server is linux debian with Apache/2.2.16)

    Any suggestions? It happens even with small filesize (< upload_max_size)

    Like

  30. Jakub Gemrot says:

    For some strange reason, upload is failing for HTTPS protocol on Firefox (if you have any problems with your certs like SSO cert). If you use HTTP it’s ok.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s