Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Ember from 'ember';
import FileField from 'ember-uploader/file-field';
var AttachmentFileUploadComponent;
AttachmentFileUploadComponent = FileField.extend({
multiple: true,
attributeBindings: ["capture", "accept"],
accept: "accept='image//*'",
capture: "camera",
changedFiles: Ember.observer('files', function() {
var files;
files = this.get('files');
if (!Ember.isEmpty(files)) {
this.sendAction('filesChanged', files);
return this.rerender();
}
})
});
export default AttachmentFileUploadComponent;
<p>
This uploader uses the Ember-Upload library
</p>
<div class="attachment-file-upload">
{{ attachment-file-upload filesChanged='filesChanged' }}
</div>
<br><br>
<h3>Here the jQuery try to clean HTML5 raw file upload</h3>
<form>
<input id="file" type="file" accept="image//*" capture="camera">
</form>
<button id="clear" {{action "reset"}}>
Clear File input
</button>
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
reset: function(){
Ember.$('#file').wrap('<form>').closest('form').get(0).reset();
Ember.$('#file').unwrap();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.