Hi all,
I want to write a function to upload a file. Now I cannot use SQLForms
for reasons that I am setting the values of the fields depending on my
session type and session id. Now can anyone help as to how I can code
the if part so that file upload will take place. Also I have tried
with request.vars.upload_f which gives the file name and
request.vars.upload_f.file.read()[These things work in mod_python so I
thought I give it a try]. So can anyone please help me as to what
needs to be done.
def uassign_f():
if (session.uid==2):
course_taken=db(db.FACOU.Faculty_name==session.name).select()
course=[]
for i in course_taken:
course.append(i.course)
form = FORM( (SELECT(course, _name="course_name" , requires =
IS_IN_SET ( course ) ) ),
(INPUT(_type="text",_name="assgnno")),
(INPUT(_type="file",_name="upload_f")),
(INPUT(_type="text",name="deaddate")),
(INPUT
(_type="submit",_name="submit",_value="SUBMIT"))
)
if(form.accepts(request.vars,formname='confirm')):
table='ASSIGNMENT'
return dict(course=course)
Thanks in advance,
Aditya
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---