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
- Create your Files Collection (See [`ostrio:files`](https://github.com/VeliovGroup/Meteor-Files))
23
23
```javascript
24
-
var Images =newFilesCollection({
24
+
constImages=newFilesCollection({
25
25
collectionName:'Images',
26
26
allowClientCode:true, // Required to let you remove uploaded file
27
-
onBeforeUpload:function(file) {
27
+
onBeforeUpload(file) {
28
28
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
29
29
if (file.size<=10485760&&/png|jpg|jpeg/i.test(file.ext)) {
30
30
returntrue;
31
31
} else {
32
32
return'Please upload image, with size equal or less than 10MB';
33
33
}
34
34
}
35
-
})
36
-
37
-
// if you want to make use of dburles:mongo-collection-instances
38
-
// you need to create a 'parent' reference to the underlying collection
39
-
Images.collection.filesCollection= Images;
35
+
});
40
36
41
37
if (Meteor.isClient) {
42
38
Meteor.subscribe('files.images.all');
43
39
}
44
40
45
41
if (Meteor.isServer) {
46
-
Meteor.publish('files.images.all', function () {
42
+
Meteor.publish('files.images.all', () => {
47
43
returnImages.collection.find({});
48
44
});
49
45
}
50
46
```
51
-
__Note:__ If you don't use Mongo Collection instances, then the `Images` variable must be attached to *Global* scope. And has same name (*case-sensitive*) as `collectionName` option passed into `FilesCollection#insert({collectionName: 'Images'})` method, `Images` in our case.
47
+
__Note:__ If you don't use Mongo Collection instances (`dburles:mongo-collection-instances`), then the `Images` variable must be attached to *Global* scope. And has same name (*case-sensitive*) as `collectionName` option passed into `FilesCollection#insert({collectionName: 'Images'})` method, `Images` in our case.
48
+
49
+
To start using `dburles:mongo-collection-instances` simply install it:
50
+
```shell
51
+
meteor add dburles:mongo-collection-instances
52
+
```
52
53
53
54
54
55
- Define your schema and set the `autoform` property like in the example below
0 commit comments