1

I tried upload file to Heroku using https://www.npmjs.com/package/express-fileupload, on my PC it works great, but on Heroku there are this error:

{"errno":-2,"code":"ENOENT","syscall":"open","path":"./public/owner_photo/f28397baea8fb4d6f6dafed9f5586a9ac0b46843acf1120a0ecad24755cfff57.jpeg"}

How can I fix it?

2
  • There is probably not a folder called ./public/owner_photo on your Heroku instance Commented Feb 14, 2017 at 17:56
  • My guess is that you don't have permission to save files on disk with heroku Commented Feb 14, 2017 at 17:57

1 Answer 1

3

Heroku has an immutable file system, meaning you can't make changes to, or additions to the file system. You'll need to store your uploads somewhere else, like Amazon S3.

Also, many upload packages by default store the uploaded file in a temp directory. So even if you are sending them to S3, you'll still need to make sure the methods you use don't attempt to do that, or set an option to disable it. I'm not familiar with express-fileupload so I can't say what methods do or do not attempt to store copies on the filesystem.

I have successfully implemented this using multiparty so I could be of more specific help with that package.

Sign up to request clarification or add additional context in comments.

1 Comment

could you please explain how you did this? I am struggling to find a solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.