douang4294 2013-02-12 23: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 06: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条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部