I am trying to first upload my image "formData" to the backend, then use the image path to upload it to ImageBB.
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './tmp')
},
filename: function (req, file, cb) {
cb(null, file.originalname)
}
})
var upload = multer({ storage: storage })
app.use(express.static(__dirname + '/tmp'));
app.use('./tmp', express.static('tmp'));
app.post(
//Uploading to ImageBB
);
This seems to work fine in my localhost, BUT when I deployed it on Cyclic.sh , this error appears in the logs:
Error: EROFS: read-only file system, open "Filename"
I think it's solved.
Though all I did was changing the ./tmp
to /tmp
.