You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Olaf Krueger <ma...@olafkrueger.net> on 2018/09/18 20:21:19 UTC

Questions about file upload, auth header and upload progress

Hi,
we're building something like a restful API using NodeJS/Restify here.
At the moment we're implementing some endpoints in order to handle file
uploads and downloads.

We're using JWT for authentication which means that we have to send an
authorization bearer with each request within the header.

Unfortunately, FileReference.upload() doesn't support the 'requestHeaders'
property so we can't set headers here. [1]
-
As an alternative, we could use URLLoader in that way, that we send the file
as base64 encoded string.
This works but base64 has performance drawbacks. At least we have to load
each file in memory before uploading.
-
So, for now, we end up using the "multipart/form data" content type with
URLLoader and send the files as ByteArray. (Thanks to the effort of Jonathan
Marston in 2007 this still works!!)

However, I am really interested how you deal with file uploads these days.
(I guess most of the APIs out there expect "multipart/form data" and some
kind of auth token?)

Moreover, does anybody know if there's any chance to inform the client about
the upload progress
by using URLLoader? (How does this work with FileReference.upload()?)
Or does anybody know if socket.io with AIR could be an option here?

Thanks,
Olaf


[1]
https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#requestHeaders

[2]
http://www.marstonstudio.com/2007/10/19/how-to-take-a-snapshot-of-a-flash-movie-and-automatically-upload-the-jpg-to-a-server-in-three-easy-steps/


 



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/