Strapi persistant uploads folder destination

Any way to choose the destination where the upload folder should live?

We are using a connected volume drive for our servers to store the uploads.

Would be great to have it in one place to also manage the backups more easily (without backing up node_modules as well :smiley: )

Thank you guys!


EDIT: I see there is this workaround with a deployment hook (Using Volume Storage - Cleavr docs). A built in solution would be great though!

EDIT 2: If i use a strapi project with a custom upload symlink hook, can i disable saving the uploads folder to //uploads? Should i just leave the uploads-field blank for that to be disabled?

Hello @sebbler,

To disable uploading to /uploads, you’ll have to disable the Activate New Deployment And Link Media Uploads hook. But the thing to consider here before disabling this hook is it performs two actions: activating the new deployment and creating a link to uploads. Also, if you disable the hook you need to create two new custom hooks:

  1. To activate the new deployment.
  2. Upload hook.

We came up with this implementation of combining two tasks into one to improve performance and don’t allow disabling it as of now unless the hook is disabled.

Another solution here can be, run your new custom hook after Activate New Deployment And Link Media Uploads. From the new hook remove the link that cleavr creates for public/uploads and re-create a new link pointing to your desired destination.

I hope it helps.

Will try this out then!

Another solution might be to just use Node SSR which does not handle uploads at all if i’m not mistaken here.

Thank you for your suggestions!

EDIT: It seems it allows for adding an upload directory as well but does not have corresponding deployment hook. Hmm…

Hello @sebbler,

Yes, that’s right. Another solution will be to use NodeJS SSR app type.

If it is an old webapp the uploading to /uploads is performed in Activate New Deployment hook.