Pushing ByteArray to POST

2019-08-10 01:20发布

问题:

I have a ByteArray of a sound recording. I would like to make a POST request that sends this as a file.

Can I do this without having the user save the file because I can only see FileReference.upload as a way to send files to POST and I don't know how to make a FileReference from a ByteArray. Thanks.

Brendan

回答1:

Yes, you can, use URLLoader and set it's format to binary, then you can put the bytearray into data property of request object.