2👍
✅
The issue is probably that you are trying to read the filename from the request.FILES
dictionary. This dictionary contains an UploadedFile
object for each file upload field in your form. The filename is a property of that UploadedFile
object. Try this:
if request.FILES['file'].name:
filename = request.FILES['file'].name
If that doesn’t work, show us your actual form and the code where you are trying to use the filename.
Source:stackexchange.com