Javascript meteor mrt集合部署
我使用collectionfs在应用程序中存储文件 我复制并粘贴了collectionfs提供的大部分自述代码到我的应用程序中,还添加了Javascript meteor mrt集合部署,javascript,meteor,meteorite,Javascript,Meteor,Meteorite,我使用collectionfs在应用程序中存储文件 我复制并粘贴了collectionfs提供的大部分自述代码到我的应用程序中,还添加了 {{cfsFileUrl "default1"}} 到我的文件列表。一切都在我的本地机器上运行 当我使用部署到???.meteor.com时会出现问题 mrt deploy ???.meteor.com 我可以上传和下载图片,也可以从cfsFileUrl中显示url 但是: 当我访问那个url时,我得到错误404 我的代码: client.html <
{{cfsFileUrl "default1"}}
到我的文件列表。一切都在我的本地机器上运行
当我使用部署到???.meteor.com时会出现问题
mrt deploy ???.meteor.com
我可以上传和下载图片,也可以从cfsFileUrl中显示url
但是:
当我访问那个url时,我得到错误404
我的代码:
client.html
<body>
{{loginButtons}}
{{>queueControl}}
<br>ta
<br>
{{>fileTable}}
</body>
<template name="queueControl">
<h3>Select file(s) to upload:</h3>
<input name="files" type="file" class="fileUploader" multiple>
</template>
<template name="fileTable">
{{#each files}}
{{cfsDownloadButton "ContactsFS" class="btn btn-primary btn-mini" content=filename}}<br>
<img src="{{cfsFileUrl "default1"}}">
{{/each}}
</template>
server.js
ContactsFS = new CollectionFS('contacts', { autopublish: false });
Meteor.publish('myContactsFiles', function() {
if (this.userId) {
return ContactsFS.find({ owner: this.userId }, { limit: 30 });
}
});
ContactsFS.allow({
insert: function(userId, file) { return userId && file.owner === userId; }
});
ContactsFS.fileHandlers({
default1: function(options) { // Options contains blob and fileRecord — same is expected in return if should be saved on filesytem, can be modified
console.log('I am handling default1: ' + options.fileRecord.filename);
console.log(options.destination());
return { blob: options.blob, fileRecord: options.fileRecord }; // if no blob then save result in fileHandle (added createdAt)
}
});
我有一个类似的问题,并张贴在collectionfs的问题页面。请查看:
ContactsFS = new CollectionFS('contacts', { autopublish: false });
Meteor.publish('myContactsFiles', function() {
if (this.userId) {
return ContactsFS.find({ owner: this.userId }, { limit: 30 });
}
});
ContactsFS.allow({
insert: function(userId, file) { return userId && file.owner === userId; }
});
ContactsFS.fileHandlers({
default1: function(options) { // Options contains blob and fileRecord — same is expected in return if should be saved on filesytem, can be modified
console.log('I am handling default1: ' + options.fileRecord.filename);
console.log(options.destination());
return { blob: options.blob, fileRecord: options.fileRecord }; // if no blob then save result in fileHandle (added createdAt)
}
});