I have a Web Server created on render (NodeJS - Express) , in which I upload image files to a folder created by the api itself. This folder is created inside api/ project folder, and I need the full path of it. The thing is, when I use __dirname I get “/opt/render/project/src/api/folder”, which is a relative path and I use a base64 library that needs full path to the folder in which I pretend to save my image, but it is crashing right now.
/opt/render/project/src/api/folder is not a relative path, that’s a full path from the root of the filesystem on Linux.
As an aside, if you’re uploading files, you should be aware that instance filesystems are ephemeral. Meaning that anything written to the instance after they boot will be lost when it’s next restarted (e.g. next deploy, or spin-down if using a free instance type). If you want to persist files, you’ll need a Render Disk or other external store.