This content has been marked as final. Show 5 replies
You have to write it to a File first if you want to upload it via FileReference so that you get progress of upload. Otherwise, you could use a URLLoader to post the data but you would have to manipulate the bytearray to mimick the same format that FileReference uses when it does a POST.
Writing to a a file actually worked fine in this case, because the file is intended to be downloaded and saved to a file locally anyway (so the user uploading it naturally doesn't have to download it). However, if I was uploading imagery that was not intended to be stored on the uploading user's machine, is there a way to make a temporary file? Or should I just manually delete the file when it's done uploading?
Either way you have to manually delete the file after uploading. You can create it normally or using createTempFile().
Interesting, I figured part of the purpose of a "temporary file" was that the OS could delete it at some point, I didn't realize apps had to delete it regardless. Still useful, thanks.
If you create a temporary file, you *could* leave it there. But usually on windows, my understanding is that only running the File Cleanup tool (launched when disk space is low) removes files from the temporary directory.