Hi All,
I need help in uploading multiple files from one form into upload folder.
Here are my code which I am trying but not working at the moment.
Controller:
def user():
values= ['','MMP2', 'MMP3', 'MMP8', 'MMP9', 'MMP10', 'MMP14', 'MMP15',
'MMP16', 'MMP17', 'MMP24']
import shutil
import os
form=FORM(TABLE(TR('Select
proteases:',SELECT(values,requires=IS_NOT_EMPTY("choose
one"),_name='protease',_onchange="jQuery.post('%s',{'protease':jQuery(this).val()})"
% URL('mmp'))),
TR('Upload fasta file:',INPUT(_type='file',
_name='fastafile',_multiple='',_id='fastafile')),
TR("",INPUT(_type="submit",_value="SUBMIT"))))
if form.process().accepted:
if form.vars.fastafile <> '':
file2 = request.vars.getlist("fastafile")
file1=request.vars.file2
shutil.copyfileobj(file2,open('/opt/web-apps/web2py/applications/multiple_upload/uploads/'+file2,'wb'))
redirect(URL('upload_data'))
return dict(form=form)
View- user.html
works fine, it takes multiple file. But not seeing any files in uploads
folder..
Help me out to correct this code
thanks
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.