I have model User and I want to develop uploading avatar to server or to S3 bucket(but I think it’s dangerous)
What is the best practice to upload files to server?
I have two ideas. First to send file to server with jquery ajax. Second to encode file to base64 set it to model of user who changes avatar and save this model, in this case Ember will send PATCH request to my API.
how is your API done? does it expect the file data as base64 or does it have a resource for uploading (posting, putting) binary data?
if you have the freedom to choose, I would go for an extra resource expecting binary data as a PUT request. It is however mostly a personal preference and also the fact that base64 if generally between 25 to 30% more data.