More than one file input issue.

21 views
Skip to first unread message

Siros

unread,
Jun 17, 2012, 2:21:32 AM6/17/12
to we...@googlegroups.com
Hello,

I have three file inputs which is defined as not null, so , the user should select three files before hitting upload button , otherwise the form will trigger  (required field ) and render the template again.

I want to make one file required but make the other two optional , any Ideas how to achieve this please ?

I want to move a head and this problem have been tripping me for the last 9 days.

Thank you in advance.

Siros

unread,
Jun 18, 2012, 4:10:41 AM6/18/12
to we...@googlegroups.com
Hello guys,

I got it !

Here is how I did it ,

after getting the user input with

i = web.webapi.rawinput().get('myfile'),

i did simple loop

for n in range(3):
    if up_form.validates():
       break


for f in i:
    loop returning list x (list of all uploaded files)

at the end of my file.


# I am using mako template Engine.

if x: # user uploaded something
    return render.index(x = x)
else: # form is not valid.
    return render.index(up_form = up_form)
  

 Thank you.

Reply all
Reply to author
Forward
0 new messages