Questions about file upload, auth header and upload progress

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Questions about file upload, auth header and upload progress

Olaf Krueger
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 with AIR could be an option here?





Sent from: