Reputation: 101
I face a problem with FileField I can't upload any files in admin page, every time I tried to upload I got this message Bad Request (400)
while the code is as below:
IDAttached = models.FileField(upload_to='/documents/%Y/%m/',null=True, blank= True)
Thank you for support,
Upvotes: 1
Views: 712
Reputation: 2050
Try without the first slash:
IDAttached = models.FileField(upload_to='documents/%Y/%m/',null=True, blank= True)
If it still doesn't work, make sure you have MEDIA_ROOT in setting.py properly configured.
Upvotes: 1