David
David

Reputation: 47

File location file upload as3

I'm trying to upload an image with AS3 on my server but I can't find the file on the server after the upload is done. The php script is called from here:

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

Both php and swf are located in /test/DJ_2.0/ and the image should go to /test/DJ_2.0/images

The completeHandler function works which makes me think that the upload does work on the AS3 side:

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

The php is:

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

Yet there is no image uploaded in the images folder.

Here is the AS3 upload code:

// 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;
}

Upvotes: 1

Views: 386

Answers (1)

Jason Sturges
Jason Sturges

Reputation: 15955

Assure file permissions on the server grant your script write access to that directory.

This appears to have resolved your issue, based upon your comment.

Upvotes: 1

Related Questions