The default behavior of FileSystemStorage is, "If a file with name already 
exists, an underscore plus a random 7 character alphanumeric string is 
appended to the filename before the extension." Do you want to always 
overwrite existing files if a file with that name already exists? That's a 
bit dangerous, but you can accomplish it by writing a custom storage.

https://docs.djangoproject.com/en/dev/ref/files/storage/#django.core.files.storage.Storage.get_available_name

On Tuesday, June 6, 2017 at 10:32:16 AM UTC-4, Andy Cheesman wrote:
>
> Hi everyone
>
> I've a problem using filefields in the admin module.I've a standard model 
> which is has a FileField (which I use to upload pdfs)
> When I'm in the administration console and attempt to upload a pdf, the 
> filename is modified from name.pdf to name_XXXX.pdf. I would like the 
> uploaded file to keep the original name!
> I've looked around at CRSF issues with django and they usually suggest 
> @csrf_exempt 
> in the views.py, which won't work in this situation. 
>
> I know this is information light but I didn't want to spam the list with 
> lots of pointless information - If anyone has any starting points, I would 
> happily provide further useful information
>
> Yours 
>
> Andy 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc6f173e-3981-436a-83f6-f825a3f1214f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to