Improved Media component with dynamic (local) upload URLs

System Information
  • Strapi Version: 4.4.7
  • Operating System: Mac
  • Database: MariaDB
  • Node Version: 18

Hey everyone,
I remember seeing some GitHub issues related to the Media component and the problem that it’s always uploading to the public /uploads directory and you can’t change that.

I thought I could rewrite it a little bit to support the dynamic paths but so far - only a mess and lots of trial and error.

What is needed:

  • a Media component I could use in different collections in Strapi
  • but each one of them should upload and read files from a different dynamic directory with variables inside, like: USER_ID/photos/ALBUM_NAME/photo.jpg

What I thought of:

  • custom field that would have a dynamic path field
  • the path field (with variables that would be then dynamically replaced) would be then passed to the Media component

but I think I’m overcomplicating it.

Do you know any solutions, maybe some already built custom fields that would help?

Thanks for all the suggestions!

up up up, any ideas?

up up up, any ideas?