flex actionscript 没有将文件上传到 PHP 页面 帮助! [英] flex actionscript not uploading file to PHP page HELP!
问题描述
请帮忙!我正在使用带有 flex sdk 3.5 和 PHP 的 actionscript 3 来允许用户上传文件 - 这是我的目标.但是,当我检查我的服务器目录中的文件时......什么都没有!出于某种原因,即使动作脚本提示上传成功(我什至尝试了所有事件侦听器以上传错误,但没有触发),但由于某种原因出现了问题.我还测试了 PHP 脚本,它在从另一个 PHP 页面接收文件时成功上传(所以我相信我的 PHP 没有任何问题).
please help! I am using actionscript 3 with flex sdk 3.5 and PHP to allow a user to upload a file -that is my goal. However, when I check my server directory for the file... NOTHING is there! For some reason SOMETHING is going wrong, even though the actionscript alerts a successful upload (and I have even tried all the event listeners for uploading errors and none are triggered). I have also tested the PHP script and it uploads SUCCESSFULLY when receiving a file from another PHP page (so i'm left to believe there is nothing wrong with my PHP).
但是,当我上传时,actionscript 并没有给我任何错误——事实上它给了我一个成功的事件......而且我知道我的 flex 应用程序实际上正在尝试发送数据,因为当我尝试上传一个大文件时,与上传小文件相比,提醒成功"事件所需的时间要长得多.
However, actionscript is NOT giving me any errors when I upload -in fact it gives me a successful event...and I know the my flex application is actually trying to send the data because when I attempt to upload a large file, it takes significantly more time to alert a "successful" event than when I upload a small file.
我觉得我已经调试了这段代码的各个方面,现在已经用完了.请,任何人,你能告诉我出了什么问题吗??或者至少我怎样才能知道发生了什么?- 我正在使用 flash bugger,但仍然出现零错误.- 我也可以毫无问题地上传.
I feel I have debugged every aspect of this code and am now spent. pleaseeee, anyone, can you tell me whats going wrong?? or at least how I can find out whats happening? -I'm using flash bugger and I'm still getting zero errors. -I can also UPLOAD without any issues.
private var fileRef:FileReference = new FileReference();
private var flyerrequest:URLRequest = new URLRequest("http://mysite.com/sub/upload_file.php");
private function uploadFile():void{
fileRef.browse();
fileRef.addEventListener(Event.SELECT, selectHandler);
fileRef.addEventListener(Event.COMPLETE, completeHandler);
}
private function selectHandler(event:Event):void{
fileRef.upload(flyerrequest);
}
private function completeHandler(event:Event):void{
Alert.show("uploaded");
}
<?php
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./test/".$_FILES['Filedata']['name']);
?>
推荐答案
一些想法:
您是否将服务器上的目录修改为 777.
have you chmod the directory on your server to 777.
在脚本中添加IOErrorEvent.IO_ERROR的EventListener,检查是否有io错误.
add the EventListener of IOErrorEvent.IO_ERROR in the script to check whether there is io error.
这篇关于flex actionscript 没有将文件上传到 PHP 页面 帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!