Hi,

Check the following :

1) Check what maximum upload size your webserver is configured for. Smaller
files go through while the bigger ones get blocked
2) File names had apostrophes, etc
3) Your actionscript handler is going out of scope because it's declared
locally,

Rgs

Sugan

-----Original Message-----
From: leokan23 [mailto:[email protected]] 
Sent: Monday, March 21, 2016 7:22 PM
To: [email protected]
Subject: Re: Flex mobile Upload to php server problem

Ok so i did a lot of trials with this and it looks like that the URLRequest
sometimes fails without a reason.

my testing code is:

protected function galleryPhotoButton2_clickHandler(event:MouseEvent):void
                        {
                                imgFile = File.documentsDirectory;
                                imgFile =
imgFile.resolvePath("header_bg_old.jpg");
                                
                                var urlRequest:URLRequest = new
URLRequest("http://MY_DOMAIN/app/photo_upload/upload.php";);
                                urlRequest.useCache = false;
        
urlRequest.contentType="multipart/form-data";
                                
                                imagelbl.text=imgFile.nativePath;
                                trace(imgFile.url);
                                image.source=imgFile.url;
                                file = imgFile;

                                if(!file.exists)
                                {
                                        
                                        trace("File does not exist");   
                                }
                                file.addEventListener(Event.COMPLETE,
uploadCompleteHandler);
                                file.addEventListener(Event.OPEN,
openUploadHandler);
        
file.addEventListener(ProgressEvent.PROGRESS, onProgress);
                                file.addEventListener(IOErrorEvent.IO_ERROR,
uploadFailed);
                                
                                
                                var variables:URLVariables = new
URLVariables();
                                variables.folder=folder.text;
                                
                                urlRequest.method=URLRequestMethod.POST;
                                urlRequest.data=variables;
                                
                                ping();
                                
                                file.upload(urlRequest, "fileToUpload",
false );
                                urlRequest = null;
                        }


I have writen a ping method (URLMonitor) to actually find out if the flex
app get's the link. 
When trying this on a local server (XAMPP), it works everytime, When i try
it on the live server, i have to wait for a while and it works
2-4 times out of 10. All the other times i get the error Error #2038: File
I/O Error. URL. I have tried in 3 different servers with the same results.

Not sure how to get over this.



--
View this message in context:
http://apache-flex-users.2333346.n4.nabble.com/Flex-mobile-Upload-to-php-ser
ver-problem-tp12292p12312.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.


Reply via email to