How to create Custom Image save folder ?

i have two more fields in my models



Both are text fields

how can i make a custom folder named media/country/shop ?

Thanks :slight_smile:

Can you be more specific as to what your objective is?

The direct answer to your question is to type mkdir media/country/shop from the command line, but I don’t really think that’s what you’re trying to ask here.

1 Like

hi, i just found out the answer

`def file_directory_path(instance, filename):`

`return f"{}/{``}/{filename}"`

now put this on your model image field.

`image_field_name = models.ImageField(upload_to=file_directory_path)`

i have now another problem, can you please see, Thanks for your time