Resizing FileReference image then reuploading, only reuploads original image.
Posted
by pfunc
on Stack Overflow
See other posts from Stack Overflow
or by pfunc
Published on 2010-04-22T19:59:03Z
Indexed on
2010/06/15
7:02 UTC
Read the original article
Hit count: 251
I can;t figure out how to do this. Someone selects and image after calling FileReference.browse(). I take that image and make a thumbnail in flash.
Then I upload that image like so:
var newFileReq:URLRequest = new URLRequest(FILE_UPLOAD_TEMP);
newFileReq.contentType = "application/octet-stream";
var fileReqVars:URLVariables = new URLVariables();
fileReqVars.image = myThumbImage;
fileReqVars.folder = "Thumbs";
newFileReq.data = fileReqVars;
newFileReq.method = URLRequestMethod.POST;
//upload the first image
fileRef.addEventListener(Event.COMPLETE, onFirstFileUp);
fileRef.upload(newFileReq, "Filedata");
All this does it upload the original image. How do I change the fileRef to upload the new thumb? I have traced out the size of the "myThumbImage" and it is correct. I have placed it visually on the stage after creating the thumb, and it seems like it works. But when I upload it to an aspx page (that basically just throws it into a folder), it uploads the original larger image.
© Stack Overflow or respective owner