我正在尝试使用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;
}