Are there really good examples of forms with file uploads with Ember? Currently I have a hacked solution with filepicker.io saving the file to a temp field on the AR model and then using sidekiq to resave the upload to paperclip in the background. I feel a bit like I am trying to look up a cows ass to see a steak instead of just asking the butcher.
How have other people approached the problem of file uploads?
That is interesting. Thank you so much for the reply. Just to make sure I understand the code, the section you referenced is the upload dialog when you are inserting an image in the post text area. Is that correct?
One issue I cannot get past is actually saving a paperclip attachment to a model without the background job. Maybe if I had a separate attachment model with a one to many relationship with the main model, I could at least get rid of the background job that is attaching the uploaded file?
Yes, is the uploading dialog in the post text area …
I also think that maybe is easier to have a separated attachment model, like discourse has the Upload model. Also I think other solution could be to upload direct to S3 and with the response create your record like in this example http://pjambet.github.com/blog/direct-upload-to-s3/, but I have never done that and I you will have to translate that to Ember
One part that is not working yet is that it starts straight away, as soon as you selected a file. I would like to start it after the push of a button. If you get that going I would love to know.
I am currently also playing around with the base64 encoded solution. Unfortunately my backend is not 100% playing along and it might not be the best idea with big files.
I would like to have it send like normal form submits work, but within my ember-data save. So that on my backend (php) I can access the file via global $_FILES variable. But haven’t found a solution for that so far.
I also started with base64 uploading, but it becomes quickly a pain when users are uploading files > 5MB on a slow connections as this can block one entire rails worker for multiple minutes.
Our current solution is to let users upload directly to S3 and then send us the resulting url, which allows bigger file uploads and is way faster then the base64 solution.
To achieve this, we have an uploads rest endpoint, which generates the presigned post to the s3 bucket and an ember data model uploading the file.