Hi everyone, I figured this one out for myself and thought maybe someone would be interested in the answer. I found that even when no value is added to the field using the browse button, (and even despite defining a default value) the REQUEST shows a 'FileUpload instance object'. Therefore you have to check that the filename attribute of this fileupload instance object is empty: if getattr(file, 'filename')!="": do something ........ Hope this can be helpful to someone, Marie
Marie Robichon wrote:
I figured this one out for myself and thought maybe someone would be interested in the answer. I found that even when no value is added to the field using the browse button, (and even despite defining a default value)
You can't define default values for inputs of type "file". For security reasons, the browser will ignore any value supplied...
Therefore you have to check that the filename attribute of this fileupload instance object is empty:
if getattr(file, 'filename')!="": do something ........
Yup, that's the way to do it :-) cheers, Chris
participants (2)
-
Chris Withers -
Marie Robichon