[web2py] Re: Problems with Upload files

2016-02-12 Thread Val K
Upload field has custom_store param-see https://www.google.ru/url?q=https://groups.google.com/forum/m/%23!topic/web2py/8X-QlbtyxEQ&sa=U&ved=0ahUKEwiL2r_DlvLKAhWBOSwKHYgSDIwQFggNMAA&sig2=WkaSH-wCNyJiXG0Su3f8uA&usg=AFQjCNEu9h6olQktR8ir7Lk7KgBi1y8aoA -- Resources: - http://web2py.com - http://web2p

[web2py] Re: Problems with Upload files

2016-02-11 Thread Alfonso Serra
Thats not the issue. Sry i didnt post the whole declaration but yes im calling process. This is the declaration form = SQLFORM.factory( fields...).process(formname = "form1") The problem was the IS_BINARY validator which was consuming the file before it got saved. If i remove it the file is sto

[web2py] Re: Problems with Upload files

2016-02-11 Thread Val K
I think you haven't from.process() form=SQLFORM() # or SQLFORM.factory - just makes a set of html-like-component (set of DIV(), INPUT() and so on) form.process() - filters and fills form with request.vars, does validation and so on On Friday, February 12, 2016 at 2:50:14 AM UTC+3, Alfons

[web2py] Re: Problems with Upload files

2016-02-11 Thread Alfonso Serra
Hi val thanks for your answer. Althought as you said, an absolute path is safer, a relative path as i have in the field form, looks like it works. I got that part covered with: filename = form1.vars.csvfile file = request.post_vars.csvfile.file file.seek(0) #something is consuming the file so i

[web2py] Re: Problems with Upload files

2016-02-11 Thread Val K
1. If you specify uploadfolder, it must be absolute path - something like os.path.join(request.folder, 'path_relative_to_your_app') 2. To store file I use like this: dst = open('your_file_absolute_name', 'wb') shutil.copyfileobj(form.vars.file, dst) dst.close() it works On Friday, Fe

[web2py] Re: Problems with Upload files

2016-02-11 Thread Alfonso Serra
Ok the first mistake ive made file.seek(0) returns None so file.seek(0).read() doesnt make sense. -- 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 rece