This is an alternative to upload images to amazon s3, based on Vulcan Files implmenting the library aws-sdk
The Vulcan Files project is outdated with the current version of Vulcan.js and is not currently working.
If you already have Meteor up and running, read this section. Otherwise, read the Complete Install section of Vulcan Starter docs.
git clone [email protected]:harold20/example-vulcan-s3-files.git
cd example-vulcan-s3-files
(or, using https
: git clone https://github.com/harold20/example-vulcan-s3-files.git
)
Before starting to run the project, you must have a settings file in .deploy/settings.dev.json
with the following infomation:
{
"amazonAWSS3": {
"mainBucket": {
"client": {
"key": "*************",
"secret": "************",
"region": "************",
"bucket": "************"
}
}
}
}
meteor npm install
meteor npm start
In order to create this implementation function, I have to introduce some changes listed below.
- Implemented the library aws-sdk that enable us to upload files easily, in a collection to save files/images. See implementation
- Used the
[email protected]
version. - Used the
react-apollo
on client to make a query if the item is being edited because the fragment doesn't work on editForm Vulcan Issue. See implementation - Implemented a callback/listener to s3 files/images collection to delete an imagen when the item is being deleted. See implementation
- Create a FSCollection that implements a collection of
meteor/ostrio:files
to storage the files. See implementation - Create a service that has the methods to upload and delete files when the item is being created or updated. See implementation
- Define the schema that contains the upload with the options property that contains a object with Collection Name, FS Collection and the collection where the document is stored. See implementation
- Refactor the upload component to work properly.See implementation
- Figure out how resolve a field as an array.