1

I have a FileReference that is being uploaded. But before upload, I call the compress() method on the ByteArray of the FileReference i.e. fileReference.data.compress().

But I observe that the uploaded file is the raw file and not the compressed file.

Is this a Flex bug or expected behavior? The data field in the FileReference is read-only. Does that come into play?

-- Sri

Sri
  • 5,805
  • 10
  • 50
  • 68

1 Answers1

0

Yes. That comes into play. You would have to load a non-FileReference ByteArray in memory, compress it and then send it as a simple multipart-formdata upload. Or in other words, you would have to do what FileReference does for free to add gzip compression support

  • Second option - I'm using a URLLoader to upload a compressed ByteArray. The problem in this case is that I cannot display a deterministic progress bar. Progress event gets triggered for FileReference.upload but not for URLLoader's upload. Any ideas? – Sri Oct 19 '11 at 06:36
  • Did you add event listener on URLLoader for progress. I think that would shows progress. – Aditya Kumar Pandey Oct 19 '11 at 10:27
  • Yeah, I've set a progress event listener. However it does not work for uploads. The Flex docs also confirm that the progress event for the URLLoader can only be used for downloads. – Sri Oct 19 '11 at 11:00
  • @Srirangan - Yeah, apparently Adobe finally added an upload progress event to the Socket class in FP11 (see ["Socket class write() - information feedback"](http://bugs.adobe.com/jira/browse/FP-6)), but they didn't follow through and add the corresponding event for the URLLoader. You can vote on the "feature request" on the ["URLLoader sending progress" page](https://bugs.adobe.com/jira/browse/FP-6353). – merv Oct 19 '11 at 16:15
  • @merv, I did vote, thanks. Anyway we can implement this ourselves without waiting for Adobe? – Sri Oct 20 '11 at 04:48