文件位置文件上传为as3

时间:2014-11-16 22:40:32

标签: php actionscript-3 flash image-uploading

我正在尝试使用AS3在我的服务器上上传图像,但在上传完成后我无法在服务器上找到该文件。 从这里调用php脚本:

var URLrequest: URLRequest = new URLRequest("uploader_script.php");

php和swf都位于/test/DJ_2.0/,图片应该转到/test/DJ_2.0/images

completeHandler函数可以使我认为上传在AS3端有效:

fileRef.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event: Event): void {
this.visible = false;
}

php是:

$filename = $_FILES['Filedata']['name'];
move_uploaded_file($_FILES['Filedata']['tmp_name'], "images/".$filename);

然而,图片文件夹中没有上传图片。

以下是AS3上传代码:

// Function that fires off when File is selected
function syncVariables(event: Event): void {
    fileRef.upload(URLrequest);
    var variables: URLVariables = new URLVariables();
    URLrequest.method = URLRequestMethod.POST;
    URLrequest.data = variables;
}

1 个答案:

答案 0 :(得分:1)

确保服务器上的文件权限授予您对该目录的脚本写入权限。

这似乎已根据您的comment解决了您的问题。

相关问题