You could try sending the resized image as a byte array or you could save it first and send it then. Ideally, you'd send it as a byte array or any other format to a server-side script that will store it or parse it ( or whatever you want to do with it ). You could also check out the stuff on this site: http://www.bytearray.org/?p=26
With best regards,
Thanks for the reply! I'm using Flex (as opposed to AIR) and I've successfully done the following:
1) Used FileReference to get a file from the file system
2) Gotten a ByteArray from the FileReference and processed to a scaled version in ByteArray format
3) Converted the scaled ByteArray to a Base64Encoded String
4) Uploaded the Base64Encoded String to the server using a URLLoader
5) Saved the upload as a JPEG on the server
something like this...
var loader : URLLoader = new URLLoader();
var req:URLRequest = new URLRequest(_uploadURL);
var params:URLVariables = new URLVariables();
params.image_data = encoder.flush();
req.data = params;
req.method = URLRequestMethod.POST;
All is well *except* that the URLLoader won't give me upload progress.
I can't save it first and then use FileReference because FileReference.save() would open another dialog, after I'd called FileReference.browse(). My only remaining challenge is to be able to display upload progress but it doesn't seem to be possible.
Any other ideas?
Thanks for the reply! Does your application resize on the client-side?
sources (not mines) can be found here: http://jeanphiblog.media-box.net/upload_process/upload.zip
unfortunately no resizing, that's why your code really interests me. I'm pretty new in action script, and some concepts are abstract for me. I'm trying to do the same script as you did with resizing but not especially with progress bar, but only find examples with progress bars and not resizing ^^
It is theoretically possible to do. I've gotten quite close to getting it to all work with a progress bar, but I've unfortunately gotten stuck. Perhaps we can work together and find a solution to this? It seems quite beneficial to have this!
So, image shrinking example can be found here:
And then we can do an upload progress as such:
However, the 2nd link, for having a progress during the upload, has been a wall for me. I get the following error:
SecurityError: Error #2176: Certain actions, such as those that display a pop-up window, may only be invoked upon user interaction, for example by a mouse click or button press.
The problem, it seems, is when successive blocks of data are submitted to the server (the way the progress works is by submitting pieces of the file one at a time, instead of the whole data at once).
Let me just say that I'm extremely dissapointed that Adobe has given no sort of progress feedback for any of its flash.net submission classes! How difficult could it possibly be for URLLoader to simply have an upload progress? Come on adobe!