douang4294 2013-02-13 07:52
浏览 122
已采纳

在Web服务器问题上部署Flex应用程序

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.

  • 写回答

3条回答 默认 最新

  • doubeishuai6598 2013-02-13 14:37
    关注

    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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?