Problem finding the path for my disk

Hello,

I try to create a disk to permanently store my images.
I have a NestJS project, a .uploads directory I need to keep saved.
When I open the render shell, the default path is ~/project/src
My uploads dir is in src, so I tried creating a disk with the path project/src/uploads.
It doesn’t work.
I also tried with /uploads ans / src/uploads, but still, the content of my upluads directory is still deleted on redeploy.

Any idea ?

( sorry for my grammar, I am not a native speaker )

Thanks in advance !

Hi,

When creating a disk, you specify a “mount path”, e.g. /uploads

The mount path is shown from the root of the filesystem. It is not relative to any folders in your code.

To persist uploaded/generated files, you need to update your code to write/read them to just the mount path (in this example, just /uploads). That means no __dirname or relative paths in your code, it would be just /uploads. The leading / is important here.

You can visualize this difference via the Shell tab. Again, with an example disk mount path of /uploads you could see the contents of the disk by changing the directory cd /uploads and listing the contents ls. Using pwd you can see the full filesystem path, which would be /uploads. Whereas your code will be under the filesystem at /opt/render/project/src