Tuesday, 15 May 2012

actionscript 3 - Modify FileReference.data bytearray before upload not working -


I have a simple file browser that allows a user to choose a local image, I upload this image I want to manipulate the server before. The problem I am facing is that when I call on fileReference.upload () it uploads the original file instead of the modified biometrater on the user's hard drive. Am I doing something wrong, this is the expected behavior or bug?

As a very basic test, if I do something like this, I get the original file:

  / / file to load _fileReference.load () in memory Do; // ... file reference on loaded trace (_fileReference.data.length); // 230189 _fileReference.data.clear (); Trace (_fileReference.data.length); // 0 // It has been commented with the next line that I expect a 0 bytes file, or an error or something, but instead it uploads the original file happily //_fileReference.data.writeBytes (MyNewByteArray); _fileReference.upload (myURLRequest);  

According to this post it should work ...

Any thoughts were greatly appreciated!

Cheers, Simon

carefully Read the reference. It says that the property of the data is read only, that means that you can not convert an image directly before uploading it.

To change an image, you can use the bitmap to get an example, then change it the way you want and then upload it to your server. / P>


No comments:

Post a Comment