File Path Structure


While creating an Image or File Upload Field, you can set your File Path to where it gets stored in the file system.I wonderend if there is a ‘way to go’ or correct way with how the file structure of a Drupal 8 site should look like? Keeping performance of the site with multiple field uploads in mind.

I assume that the structure of [date:costum:Y]/[date:costum:m] given by default could be improved. And I also would think that choosing field entity names instead of static names (e.g. when I have an upload field for logos don’t call it ‘logo’) would be better?


Kind regards,

Another question: Is there a way changing existing uploaded file paths? Because at the point I uploaded files, I didn’t knew that the fiel path settings would be good to have.

Hello Nadine,

This is totally “personal” and depends on how you want to organise your uploads in order to easier track them in the future. For example the file path of type year/month is good if you have daily uploads and you want to structure them by month in order to find them easier. Another example is to have them by username of uploader. If you have multiple users uploading their files in the website and will need to track them, its a good idea to have a structure of type <username>/filename.

Also you are not obliged to have sub-folders. You can have a main folder called /logos and upload everything there. However if you know that you will have a lot of logos (eg > 20), its. a good idea to organize them.

All uploaded files are uploaded under the file path you have set. The root folder is considered the /files folder of your website. In order to move old files you can just mount your website and move the files from the one folder to another. However in that case if you have already given the image links to third parties, those links will return 404 since the images will not exist anymore.

Hope that helps.


Yes, that helps.
Thank you Konstantinos!