On May 26, 12:30 pm, Bastien <bastien.roche...@gmail.com> wrote: > Hi, > > When I have some validation errors in my forms they automatically get > reloaded after POST with all the fields already filled with what the > user already introduced before POST and she only has to change > whatever was wrong in the first place. But for files or images, the > path disappears and the user has to choose again which image she wants > to upload. I'd like these fields to appear populated along the others. > > I thought sending form = Form(request.POST, request.FILES) to the > template was enough. Is there something I missed or do these fields > need to be populated in another way? > > thanks, > Bastien
This question comes up here occasionally. Here's what I said last time: This isn't a Django issue. It's a standard property of browsers: you can't set an initial value for file input fields. This is a security measure, to stop malicious pages uploading files from your hard drive without your explicit instruction. There isn't really any way round it, except to do something extremely complicated like GMail does and upload the file in the background while the user fills in the form, then replace the file field with a reference to the uploaded version of the file. -- DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---