croppio.com
croppio.com

Reputation: 1883

deploying flex application on web server issue

I have a simple flex application that can upload local files. It is a simple button, and on click event a file dialog appear.

The selected files are then processed by a PHP script and works great on my local machine. When i try to move my flex-debug, or flex-release project to a remote server the upload functionality doesn't work any more.

If a inspect the network the POST is executed but for some reasons it has status of pending for 1 minute, but after success is doesn't run well, as expected, the files are not uploaded.

// file is a file:FileReference object
var uploadURL:URLRequest = new URLRequest();
var params:URLVariables = new URLVariables();
file.addEventListener(Event.COMPLETE, uploadComplete);
params.maxSize = maxSize;
uploadURL.method = URLRequestMethod.POST;
uploadURL.data = params;
uploadURL.url = uploadScript;
file.upload(uploadURL, IMAGE_FIELD);
file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadDataComplete);
file.addEventListener(Event.COMPLETE, uploadComplete);    

Edit: When i try to move my debug folder generated from Flash Builder 4.5 from C:\www to my second local host on D:\www the upload script doesn't work anymore. Maybe i miss some deployment options and only sees it on C:\www where my .mxml reside.

Edit2: There was a problem on remote server i.e. move upload file function was not working properly. The problem was from upload.php script and not from Flex after all, thanks for help and sorry for disturbance.

Upvotes: 2

Views: 322

Answers (3)

Adrian Pirvulescu
Adrian Pirvulescu

Reputation: 4340

1) provide service path or similar example.

2) How big is the uploaded file, have you tested with under 2Mb (default php.ini allows just small file size)

3) What is the exact error message that you get ?

4) can you listen for ProgressEvent, maybe your upload is just slow... and you use a big file.

5) listen for IOErrorEven.IO_ERROR and SecurityErrorEvent.SECURITY_ERROR

Upvotes: 1

Ilya Zaytsev
Ilya Zaytsev

Reputation: 1055

Try to use:

var request : URLRequest = new URLRequest("http://{you_site_domain}/upload.php");

and check

loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ioErrorHandler);

Upvotes: 3

Varun Bajaj
Varun Bajaj

Reputation: 1043

There are few points i guess you should check-

1) The service path you are using, recheck it again with running in browser addressbar. 2) Check the upload path folder permission.

Upvotes: 1

Related Questions