Search code examples
apache-flexfile-uploadfilereference

Flex FileReference upload() and .data ... does this load the whole file into memory?


I need to upload a very large file to my server, through my Flex application, and I see that Flex Filereference upload() seems to be able to handle it. Does the upload() methods uploads a 'stream' to the servlet, or does it sends the whole ByteArray (As I understand it, the ByteArray will have the whole file contents, so a >1Gb file will flood my memory).

I haven't found confirmation of one or the other. It seems flex.net.FileReference source code is part of flash, not the open source flex, so I cant take a peek.

Anyone can confirm or deny the usage of the whole byteArray when sending file contents to the server?

Thanks


Solution

  • When trying to upload big files using Flash, the loading of the file into memory is not your biggest concern - the upload itself is quite unreliable. According to the Flex reference Flash player officially supports upload file sizes of up to 100 MB. My experience confirms that big file uploads often fail. You may check this file upload component for uploading large files in chinks and resuming partial uploads. However this solution also needs to fully load the file into memory before starting the upload.