A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: File upload in Mozilla problem

  1. #1
    Member
    Join Date
    Jun 2006
    Location
    Croatia
    Posts
    90

    File upload in Mozilla problem

    Hi,

    I am using Flex with server side php script to upload a file from Flex to server and everything works fine when i use Internet Explorer but in Firefox i get the following error:

    Code:
    Error #2038: File I/O Error.
    I googled around and found out that there is a problem with Firefox handling sessions but couldn't find solution to this problem. Has anyone else came across this problem, what would be the solution to it?

    Here is my mxml code:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();">
    	<mx:Script>
    		<![CDATA[
    		
    			private var urlRequest:URLRequest;
    			private var fileReferenceList:FileReferenceList;
    			private var serverSideScript:String = "http://localhost/uploadFile.php";
    		
    			private function init():void {
    				urlRequest = new URLRequest(serverSideScript);
    				fileReferenceList = new FileReferenceList();
    				fileReferenceList.addEventListener(Event.SELECT, fileSelectedHandler);
    			}
    			
    			private function uploadFile():void {
    				fileReferenceList.browse();
    			}
    			
    			private function fileSelectedHandler(event:Event):void {
    				var fileReference:FileReference;
    				var fileReferenceList:FileReferenceList = FileReferenceList(event.target);
    				var fileList:Array = fileReferenceList.fileList;
    
    				// get the first file that the user chose
    				fileReference = FileReference(fileList[0]);
    				
    				// upload the file to the server side script
    				fileReference.addEventListener(Event.COMPLETE, uploadCompleteHandler);
    				fileReference.upload(urlRequest);
    				
    				// update the status text
    				statusText.text = "Uploading...";
    			}
    			
    			private function uploadCompleteHandler(event:Event):void {
    				statusText.text = "File Uploaded: " + event.target.name;
    			}
    			
    		]]>
    	</mx:Script>
    	
    	<mx:Label text="Upload File From Flex to PHP" fontWeight="bold"/>
    	<mx:Label text="Choose a file..." id="statusText"/>
    	<mx:Button click="uploadFile();" label="Upload File"/>
    	
    </mx:Application>
    And my php script:

    PHP Code:
    <?php

    $tempFile 
    $_FILES['Filedata']['tmp_name'];
    $fileName $_FILES['Filedata']['name'];
    $fileSize $_FILES['Filedata']['size'];

    move_uploaded_file($tempFile"./" $fileName);

    ?>
    Thanks in advance

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    This is a server problem. open the .htaccess file and enter these two lines:

    SECFILTERENGINE OFF
    SECFILTERSCANPOST OFF

    Also make sure the folders have the 0777 permission.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Jun 2006
    Location
    Croatia
    Posts
    90
    Are you sure it's server side problem, why is it working fine in Internet Explorer? I'll try your advice, thanks for help.

  4. #4
    Member
    Join Date
    May 2007
    Location
    Poland
    Posts
    65
    Quote Originally Posted by blu3
    Are you sure it's server side problem, why is it working fine in Internet Explorer? I'll try your advice, thanks for help.
    Did it work afterall?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center