I tried ContentFile and save() method from FieldFile in views.py, but in the model I'm using ImageField. It even works. But the Image saving with strange id like NameOfImage_gdicbHhvd.jpg. How can I save it normally?
Asked
Active
Viewed 64 times
0
-
It has added `_gdicbHhvd` to give it a unique filename because you already have `NameOfImage.jpg` saved in the directory you're saving the files – HenryM Feb 06 '18 at 19:05
-
@HenryM But if I want overwrite file? – user9322881 Feb 06 '18 at 19:07
-
Try this answer: https://stackoverflow.com/questions/9522759/imagefield-overwrite-image-file-with-same-name – HenryM Feb 06 '18 at 19:13