FileField empty after form validation

278 katselukertaa
Siirry ensimmäiseen lukemattomaan viestiin

josephi

lukematon,
23.8.2010 klo 4.14.4423.8.2010
vastaanottaja Django users
Hi, I have a suspicion that my problem might not be Django specific,
but I'm not entirely sure, and would appreciate any pointers to
information on the subject.

I have a Form with several fields, one of which is a FileField. This
field is required. If I fill in the FileField but the form doesn't
validate because of other field errors the FileField widget becomes
empty once the form is redisplayed after validation. This forces the
user to re-select their file.

Can anyone tell me the reason for this? Is there a workaround?

Thankyou

Joseph

Karen Tracey

lukematon,
23.8.2010 klo 6.14.1923.8.2010
vastaanottaja django...@googlegroups.com
The reason is because typically browsers don't allow the web server to pre-fill a file input with a value. (Allowing this would enable malicious servers to easily trick naive users into uploading sensitive files.)

Karen
--
http://tracey.org/kmt/

Vastaa kaikille
Vastaa kirjoittajalle
Välitä
0 uutta viestiä