I have a pretty standard upload form - user picks a file, then hits the upload button. But now I need to add data to the post - after the user picks the file, but obviously before the post leaves the browser. Note that the post is a direct post to a third party (Amazon S3).
Is there a way to make a form with a file picker (or something that looks like one), then the user picks a local file, then hits a button, => javascript calls my server, gets a response, builds the 'real' post and then sends this new post to a third party server.
Basically, until the user picks the file, I don't know a few things (mime type). I know that browsers send this info, but Amazon AWS pre signed posts ignore what the browser says.
I can hit my server (ruby sinatra) with an ajax call from the javascript, which will return some JSON, etc to the script, which will then post to Amazon S3.
My problem could just be my newbieness to javascript...