My problem is that when I set storagePath it does not store images anywhere, even though the upload is successful (it says). If I remove storagePath then it stores them in the .meteor folder.
export const Images = new FilesCollection({
collectionName: 'Images',
allowClientCode: false,
storagePath: '/public/uploads/avatars',
onBeforeUpload(file) {
if (file.size <= 10485760 && /png|jpg|jpeg/i.test(file.extension)) {
return true;
}
return 'Please upload image, with size equal or less than 10MB';
}
});
Any idea why it’s acting up like this? I am running on Windows so there isn’t any permission error.
@dr.dimitru OK, that makes a lot of sense (not really). Thanks for the input.
Do you have any clue on how I can save the images to the relative /public/ folder in my project directory (automatically)?
Where are files stored by default?: by default if config.storagePath isn’t passed into Constructor it’s equals to assets/app/uploads and relative to running script:
On development stage: yourDevAppDir/.meteor/local/build/programs/server. Note: All files will be removed as soon as your application rebuilds or you run meteor reset. To keep your storage persistent during development use an absolute path outside of your project folder, e.g. /data directory.
On production: yourProdAppDir/programs/server. Note: If using MeteorUp (MUP), Docker volumes must to be added tomup.json, see MUP usage