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.

This entry was posted in Errors, Flex. Bookmark the permalink.

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

  1. JabbyPanda says:

    I’d like to refine the description of this error code.

    This error occurs everytime when you specify wrong path to the server-side upload script, not to a file itself.

  2. jeruel says:

    does it mean relative path will not work for this? I have tried locally and it works but not when I have uploaded to server.

  3. Pingback: Joeflash’s Enigmacopaedia » Error #2044: Unhandled IOErrorEvent - Solution

  4. Blake says:

    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

  5. JabbyPanda says:

    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

  6. 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.

  7. Christopher says:

    If testing locally and you’re getting these errors, be sure that your firewall is not blocking FLEX or FLASH.

  8. Nick says:

    My problem when I was trying multiple, queued uploads, was that the FileReference was going out of scope. I used a strong reference instead of a weak one while listening for the IOError event, and could then handle it.

    I put some of the other things I tried at http://dev.nuclearrooster.com/2008/04/05/uploading-with-a-filereference-from-flex-3-on-os-x/

  9. Jesus says:

    Taher Mestiri, man you saved my life with this :

    SecFilterEngine Off
    SecFilterScanPOST Off

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

  10. Jonathan says:

    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.

  11. 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

  12. TheCosmonaut says:

    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

  13. TheCosmonaut says:

    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?

  14. Rob says:

    Legend, thanks!

  15. Anders says:

    My problem was the size off the file.
    Test with a smaller file and see if it works.

    My asp.net installation accepted 3.1MB.

  16. devon says:

    Nick that did the trick! I was using a weak event listener reference for my FileRef object. Strong refs = no more errors.

  17. 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?

  18. 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

  19. 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.

  20. jim says:

    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

  21. 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.

  22. 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.

  23. 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.

  24. 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?

  25. 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.

  26. krunal says:

    is it working for flex web application?

  27. vijay says:

    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.

  28. mattimatti says:

    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

  29. pam says:

    On nginx was getting this error for files greater then 1mb. Fixed using the client_max_body_size directive.

  30. 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

  31. 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.

  32. 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!!!

  33. 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 .

  34. 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.

  35. 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.

    • 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

  36. 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.

  37. 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.

  38. sunil says:

    I get 2044 error when trying to display a local html file using StageWebView in a Flex Mobile project.

    • 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;
      			}
  39. 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:

  40. Pingback: Xml file not displaying. | free icons download

  41. NicoAd says:

    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)

  42. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Wrap your code before posting! Click the links below:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">