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

我有一个简单的flex应用程序,可以上传本地文件。 它是一个简单的按钮,在单击事件时会出现一个文件对话框。</ p>

然后,所选文件将由PHP脚本处理,并在我的本地计算机上运行良好。 当我尝试将我的flex-debug或flex-release项目移动到远程服务器时,上载功能不再起作用。</ p>

如果检查网络,则执行POST但 由于某些原因,它有待处理状态1分钟,但成功后运行不正常,正如预期的那样,文件不会上传。</ p>

  //文件是一个 file:FileReference对象
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 );

</ code> </ pre>

编辑:当我尝试将从Flash Builder 4.5生成的调试文件夹从C:\ www移动到D:\ www上的第二个本地主机上传脚本时 不再起作用了。 也许我想念一些部署选项,只能在我的.mxml所在的C:\ www上看到它。</ p>

Edit2:远程服务器出现问题,即移动上传文件功能无法正常工作 。 问题来自upload.php脚本而不是来自Flex,感谢您的帮助和对不起的干扰。</ p>
</ div>

展开原文

原文

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.

douyan0732
douyan0732 你检查了文件夹的安全性/权限吗?上传失败主要发生在写入问题上。文件大小也是一个障碍,但我想你已经检查过,因为有人已经指出了它。
7 年多之前 回复
donte1234567
donte1234567 要上传文件,您应该使用FileReference.upload()help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/....从您提供的代码中,我不清楚您使用的是什么。
7 年多之前 回复
donglang5157
donglang5157 您是否上传到与SWF托管的域不同的域?也就是说,我认为使用Flex应用程序(并且用户下载300+Kb)对于简单的上传按钮来说是过度的。
7 年多之前 回复

3个回答



尝试使用:</ p>

  var request:URLRequest = new URLRequest(“http”  :// {you_site_domain} /upload.php“); 
</ code> </ pre>

并检查</ p>

  loader.addEventListener(  IOErrorEvent.IO_ERROR,ioErrorHandler); 

loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,ioErrorHandler);
</ code> </ pre>
</ div>

展开原文

原文

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);

douzhang1115
douzhang1115 是的,但正如他在更新中指出的那样,他正在使用“c:”驱动器的路径...这不再是相对的。
7 年多之前 回复
dongpochi9741
dongpochi9741 Flash应该可以正常使用相对URL; 不需要指定完整的域名。
7 年多之前 回复



1)提供服务路径或类似示例。 </ p>

2)上传文件有多大,你是否在2Mb下测试过(默认php.ini只允许
small文件大小)</ p>

3 )你得到的确切错误信息是什么? </ p>

4)你能听到ProgressEvent,也许你上传的速度很慢......你使用的是一个大文件。</ p>

5)听听 IOErrorEven.IO_ERROR和SecurityErrorEvent.SECURITY_ERROR </ p>
</ div>

展开原文

原文

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

douren1891
douren1891 我想问1)是和uploadURL.url = uploadScript; 例。 你也可以检查服务器上的PHP日志吗?
7 年多之前 回复



我猜您应该检查几点 - </ p>

1)您的服务路径是 使用,在浏览器地址栏中运行再次重新检查。
2)检查上传路径文件夹权限。</ p>
</ div>

展开原文

原文

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.

dongzong2017
dongzong2017 Flex只能通过3种方式与PHP通信 - 1)HTTPService 2)WebService 3)远程处理(AMFPHP或任何其他)您使用的是哪一个以及如何使用?
7 年多之前 回复
duanluwei9374
duanluwei9374 你能提供服务途径吗?
7 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐