Looking to save an image uploaded via a file input into a database. Utilizing the redactor plugin to browse the image with the following code:
$('.editor').redactor({
imageUpload:"/uploads"
});
Once an image is selected or browsed, it is sent directly to the server using Meteor's HTTP methods.
HTTP.methods({
'/uploads': function(data) {
console.log(data)
Meteor.call("uploadImage",data)
return JSON.stringify({'Hello':"hello"});
}
});
Upon logging the data, a 64-bit binary code for the image is retrieved. The challenge now lies in saving this data to a MongoDB database.
While utilizing meteor-collection2 to define fields and types, the appropriate data type for storing images in MongoDB remains unknown.
Attempting to use MongoDB GridFS for image storage. How can images be saved in MongoDB? Thank you!