我正在尝试在我的服务器上上传带有 AS3 的图像,但上传完成后在服务器上找不到该文件。从这里调用 php 脚本:
var URLrequest: URLRequest = new URLRequest("uploader_script.php");
php 和 swf 都位于/test/DJ_2.0/中,图像应转到/test/DJ_2.0/images
完整的处理程序函数有效,这让我认为上传确实在 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;
}
确保服务器上的文件权限授予脚本对该目录的写入访问权限。
根据您的评论,这似乎已经解决了您的问题。