The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/lib/fileUpload.coffee

24 lines
628 B

if UploadFS?
@fileCollection = new Mongo.Collection 'rocketchat_uploads'
fileCollection.allow
insert: (userId, doc) ->
return userId
update: (userId, doc) ->
return userId is doc.userId
remove: (userId, doc) ->
return userId is doc.userId
Meteor.fileStore = new UploadFS.store.GridFS
collection: fileCollection
name: 'rocketchat_uploads'
collectionName: 'rocketchat_uploads'
filter: new UploadFS.Filter
maxSize: 2097152
contentTypes: ['image/*', 'audio/*']
onFinishUpload: ->
console.log arguments
onRead: (fileId, file, req, res) ->
res.setHeader 'content-disposition', 'download'