Which location do I use when uploading a file from client to Hyperdev server with multer?

Hey all,

I’m trying to teach myself the MEAN stack and Hyperdev has become my best friend along the way!

I’m currently trying to create a form that allows me to upload a file(image) and then save it to my MongoDB. I’m using multer, but no matter what destination I put for storage I get this error:

"error: EROFS: read-only file system, open ‘assets/1d19426b73718f34b29a0a29b82283ec’
_ at Error (native)"_

My current code:

var multer = require('multer');
var upload = multer({dest: './assets'});

app.post('/newproduct', upload.single('image'), function (req, res, next) {
  // req.files is array of `photos` files
  // req.body will contain the text fields, if there were any

The only directory where you can store files is the /tmp directory. However, you should know that it’s cleaned up regularly.

Someone may confirm this, but I’m 99% sure.

Hi! We’re really glad to hear that HyperDev has been a valuable learning tool as you explore the mean stack! For the time being, Jonathan is right. The file system is read-only in the current iteration, but we’re working to release a writable file system within a few weeks!

1 Like