Hi all, I am faced with an edge case when using a form *FileField*. On my webpage, the user uploads a mandatory excel file and, optionally, a zip file full of pictures. So my form has two *FileField*s. Upon submission, both the excel file and zip file (if uploaded) are processed in a background task and saved to Amazon S3. I have custom validators that make sure that the extensions of both files match Excel and zip respectively.
Whilst this setup behaves as expected when a user uploads files, it does not work when a user uploads folders: in this case, if a user uploaded by mistake a folder in place of a zip file, the validation would pass since the file passed to it is *None *and the field is required=False. However, the processing would fail since my code that uploads to S3 expects a file, not a folder. Essentially the problem boils down to the *FileField *giving the file the value of *None *if a user drags a folder to it and uploads it, exhibiting therefore the same behaviour if the user uploads a folder or uploads nothing at all. Is there a way to detect a folder upload programmatically? Thanks, Alberto -- 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/7615db8a-ff6b-4ad6-8730-6dcd2d153621%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

