Re: [web2py] Re: REF: Upload of Files

2013-03-23 Thread wwwgong
Thanks for sharing the solution, I did not know that quotes_file holds the file content On Friday, March 22, 2013 2:34:16 AM UTC-4, software.ted wrote: Ok great and thanks for all your help, the file is being saved and all works as expected!!! code that works below: def index(): form

Re: [web2py] Re: REF: Upload of Files

2013-03-22 Thread Teddy Nyambe
Ok great and thanks for all your help, the file is being saved and all works as expected!!! code that works below: def index(): form = SQLFORM.factory(Field(first_name),Field(quotes_file, upload, uploadfolder=os.path.join(request.folder, 'uploads'))) test = '' first_name = '' if

Re: [web2py] Re: REF: Upload of Files

2013-03-21 Thread Teddy Nyambe
Anthony, I have noticed an error in the code. I have created a very simple form to test the upload without using components. The code is as follows: Controller: = def index(): form = SQLFORM.factory(Field(first_name),Field(quotes_file, upload,

Re: [web2py] Re: REF: Upload of Files

2013-03-21 Thread Anthony
if request.vars.quotes_file: Sorry, I didn't realize this, but apparently if you do if [cgi.FieldStorage object] you get False rather than True, so instead try: if hasattr(request.vars.quotes_file, file): or import cgi if isinstance(request.vars.quotes_file, cgi.FieldStorage) I

Re: [web2py] Re: REF: Upload of Files

2013-03-21 Thread Teddy Nyambe
But the question again is where is the file stored, its not appearing in the specified uploads directory for manipulation. What I want to do is upload an excel sheet with specific columns of data, then get the data and insert into db with similar columns On Mar 21, 2013 6:48 PM, Anthony

Re: [web2py] Re: REF: Upload of Files

2013-03-21 Thread Anthony
Recall that the suggestions to forego calling form.process() and instead just check for and directly manipulate request.vars.quotes_file was assuming you did not want to permanently store the file. If you do want to keep the file, then you should call form.process() (or include code to

[web2py] Re: REF: Upload of Files

2013-03-20 Thread Anthony
As is, your code should generate an error because you haven't specified an upload folder, which is required when passing new Field objects to SQLFORM.factory. Try: import os SQLFORM.factory(Field(quotes, upload, uploadfolder=os.path.join( request.folder, 'uploads'))) If you don't want

Re: [web2py] Re: REF: Upload of Files

2013-03-20 Thread Teddy Nyambe
Anthony, Am having a very funny behavior. I am loading a form in a component quotes.load in another page of a div. When i access the component directly through the URL address the {{=BEAUTIFY(request.vars)}} am able to see the uploaded file, but accessing it through the component its sending

Re: [web2py] Re: REF: Upload of Files

2013-03-20 Thread Anthony
Did you set ajax=True or ajax_trap=True in your LOAD() call? If not, the form will get posted to the action of the containing page, not the component action. Anthony On Wednesday, March 20, 2013 10:06:28 AM UTC-4, software.ted wrote: Anthony, Am having a very funny behavior. I am loading a

Re: [web2py] Re: REF: Upload of Files

2013-03-20 Thread Teddy Nyambe
Actually this this is how am loading it, please advise: {{=A('Quotes', component=URL('quotes','quotes.loadp ), target='quote-content')}} div id='quote-content'/div One funny thing is when I add a simple text field to the SQLFORM.factory and submit sample content...its displayed...only for