You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-2Lines changed: 55 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,6 +142,35 @@ Generate the form with `{{> quickform}}` or `{{#autoform}}` e.g.:
142
142
143
143
Autoform should be wrapped in `{{#if Template.subscriptionsReady }}` which makes sure that template level subscription is ready. Without it the picture preview won't be shown. You can see update mode example [here](https://github.com/VeliovGroup/meteor-autoform-file/issues/9).
144
144
145
+
## Accept configuration
146
+
147
+
### Usage
148
+
149
+
You can configure the file selector, to only allow certain types of files using the `accept` property:
150
+
151
+
```js
152
+
Schemas.Posts=newSimpleSchema({
153
+
title: {
154
+
type:String,
155
+
max:60
156
+
},
157
+
picture: {
158
+
type:String,
159
+
autoform: {
160
+
afFieldInput: {
161
+
type:'fileUpload',
162
+
collection:'Images',
163
+
accept:'image/*'// or use explicit ext names like .png,.jpg
164
+
}
165
+
}
166
+
}
167
+
});
168
+
```
169
+
170
+
The accept values works makes use of the native HTML `accept` attribute. Read more at the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
171
+
172
+
Please read the section on **custom upload templates** and how to integrate configs like *accept* to your custom template.
173
+
145
174
## Multiple images
146
175
147
176
Multiple images — __not fully supported yet__
@@ -191,13 +220,20 @@ Your custom file preview template data context will be:
0 commit comments