Skip to content

Instantly share code, notes, and snippets.

@bsylvain
Created August 21, 2019 09:10
Show Gist options
  • Save bsylvain/3ca6bfc294a8ddf10e6bd8f90ca330ee to your computer and use it in GitHub Desktop.
Save bsylvain/3ca6bfc294a8ddf10e6bd8f90ca330ee to your computer and use it in GitHub Desktop.
ember upload
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions:{
uploadFile(file){
file.upload(
'www.test.com/fakeUpload/',{
method: 'PATCH',
fileKey: 'data[attributes][file]'
})
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#file-upload name="illustration"
accept="*"
method="GET"
onfileadd=(action "uploadFile")}}
<a class='btn btn-primary'>
File</a>
{{/file-upload}}
<br>
<br>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "2.17.2",
"ember-template-compiler": "2.17.2",
"ember-testing": "2.17.2"
},
"addons": {
"ember-data": "2.17.1",
"ember-file-upload": "2.6.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment