An Ember.js file uploader that works with any browser that supports FormData.
Ember Uploader is a Ember CLI compatible addon and can be installed as such.
ember install ember-uploader
Create a new component called
file-upload and extend
EmberUploader.FileField provided by
ember-uploader. If you're using
EmberUploader.FileField, it will
automatically give you an input field, and will set
files property when you
choose a file.
Call the component, pass it the url, and thats it!
Ajax Request Method
By default, the request will be sent as
POST. To override that, set
creating the object:
;const uploader = Uploader;
;const uploader = Uploader;// will be sent as -> post[file]=...
By default parameter will be
;const upload = Uploader;// will be sent as -> upload=...
Returned value from uploader will be a promise
Modifying the request
Ember uploader uses jQuery.ajax under the hood so it accepts the same
ajax settings via the
ajaxSettings property which is then merged with any
settings required by Ember Uploader. Here we modify the headers sent with
Uploading to S3
Uploading to S3 works in similar manner to the default uploader. There is only one extra step required before uploading.
You'll need to setup your backend to be able to sign the upload request, to be able to make an authenticated request to S3. This step is required to avoid saving secret token on your client.
For learning how to setup the backend, check the wiki
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
$ npm install -g ember-cli
To get started with development simply do a
yarn install inside the cloned
repository to install all dependencies needed for running
Lint and test your code using:
Copyright (c) 2014 Joshua Borton Licensed under the MIT license.