vazco/Universe Files Blaze UI
<template name="myFile">
{{> universeUploadButton name='file' value=doc.avatar class='img-circle'}}
</template>
Template.myFile.events({
fileUploaded (e, tmpl, result) {
console.log('uploaded', result);
},
fileError (e, tmpl, error) {
console.error('uploaded', error);
}
});
<template name="myImage">
{{> universeUploadButton name='image' isImage=true value=doc.avatar class='img-circle'}}
</template>
- parameter isImage=true will activate making sizes for uploaded image (default: small, medium, large)
Template.myImage.events({
fileUploaded (e, tmpl, result) {
console.log('uploaded', result);
},
fileError (e, tmpl, error) {
console.error('uploaded', error);
}
});
<template name="myAvatar">
{{> universeAvatar name='avatar' value=doc.avatar class='img-circle'}}
</template>
Template.myAvatar.events({
fileUploaded (e, tmpl, result) {
console.log('uploaded', result);
},
fileError (e, tmpl, error) {
console.error('uploaded', error);
}
});
import {getFileSchemaField} from 'meteor/universe:files-blaze-ui';
// adding to schema:
const mySchema = new SimpleSchema(Object.assign({
title: {
type: String
}
},
getFileSchemaField({
name: 'file',
isImage: false
})
));
<template name="myTemplate">
{{#autoForm schema=getSchema id="myForm"}}
{{> afQuickField name='title'}}
{{> afQuickField name='file' class='img-circle' label=false}}
<button type="submit">Submit</button>
{{/autoForm}}
</template>
import {getFileSchemaField} from 'meteor/universe:files-blaze-ui';
// adding to schema:
const mySchema = new SimpleSchema(Object.assign({
title: {
type: String
}
},
getAvatarSchemaField({
name: 'logo'
})
));
<template name="myTemplate">
{{#autoForm schema=getMySchema id="myLogo"}}
{{> afQuickField name='title'}}
{{> afQuickField name='logo' label=false}}
<button type="submit">Submit</button>
{{/autoForm}}
</template>
Like every package maintained by Vazco, Universe Files Blaze UI is MIT licensed.