To which directory images or files should be uploaded in Meteor?

烈酒焚心 提交于 2019-12-13 02:26:42

问题


In Meteor, what should be the directory for uploading images or files?

Currently this is my directory where I am uploading all the Images:

meteorApp/public/uploads/images/

But whenever I upload images, it refreshes my client. Its because Meteor is continuously looking for a change in its directory or files. So where should I set my uploads directory to?


回答1:


The solution is to put files in a place Meteor does not care about: hidden folder (.name), ignored folder (name~), or folder outside of Meteor directory.

Refer this answer.




回答2:


An alternative solution is to use the Collection FileSystem package which provides a complete file management solution like uploading, downloading, synchronization, copying, etc.

It can be then plugged to local filesystem or even Amazon S3.

Here is the repo : https://github.com/CollectionFS/Meteor-CollectionFS. You need to add first the main package :

meteor add cfs:standard-packages

And then the storage adapter you want to use:

  • Local filesystem (directory like /public, /uploads)

    meteor add cfs:filesystem

  • Amazon S3 (my fav)

    meteor add cfs:s3

  • GridFS

    meteor add cfs:gridfs

  • Even Dropbox!

    meteor add cfs:dropbox

The doc is really complete, you may find what you are looking for! :)



来源:https://stackoverflow.com/questions/34527629/to-which-directory-images-or-files-should-be-uploaded-in-meteor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!