import os
SQLFORM.factory(Field("quotes", "upload", uploadfolder=os.path.join(request.folder, 'uploads')))
if request.vars.quotes:
manage_quotes(request.vars.quotes.file)
controller
def quotes():
form = SQLFORM.factory(Field("first_name"), Field("quotes", "upload", uploadfolder=os.path.join(request.folder,'uploads')))
file_name=""
first_name = ""
if request.vars.quotes:
file_name="test"
if request.vars.first_name:
first_name = "Testing"
return dict(form=form, file_name = file_name, first_name = first_name)
view::-------->>>>>>>
First name is: {{=file_name}}<br>
{{=form}}<br>
First name is:{{=first_name}}
filename is returning empty all the time.
--
---
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
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 upload is not showing.
| <script type="text/javascript"><!-- | |
| // These variables are used by the web2py_ajax_init function in web2py_ajax.js (which is loaded below). | |
| var w2p_ajax_confirm_message = "Are you sure you want to delete this object?"; | |
| var w2p_ajax_date_format = "%Y-%m-%d"; | |
| var w2p_ajax_datetime_format = "%Y-%m-%d %H:%M:%S"; | |
| var ajax_error_500 = 'An error occured, please <a href="/testapp/default/index?first_name=bggfbfg&quotes_file=FieldStorage%28%27quotes_file%27%2C+%27rows+%282%29.csv%27%2C+%27circular.circular_no%2Ccircular.recipients%2Ccircular.circular_title%2Ccircular.circular_date%5Cr%5CnNAZ%2F1%2F2013%2CALL+MEMBERS+OF+STAFF%2CLunch+to+be+served+at+the+Motel%2C2013-03-01%5Cr%5Cn%27%29">reload</a> the page' | |
| //--></script> any idea on whats going on here? |
if request.vars.quotes_file:
if hasattr(request.vars.quotes_file, "file"):import cgi
if isinstance(request.vars.quotes_file, cgi.FieldStorage)
I have further noticed this error in the page source after making a submit:
var ajax_error_500 = 'An error occured, please <a href="/testapp/default/index?first_name=bggfbfg&quotes_file=FieldStorage%28%27quotes_file%27%2C+%27rows+%282%29.csv%27%2C+%27circular.circular_no%2Ccircular.recipients%2Ccircular.circular_title%2Ccircular.circular_date%5Cr%5CnNAZ%2F1%2F2013%2CALL+MEMBERS+OF+STAFF%2CLunch+to+be+served+at+the+Motel%2C2013-03-01%5Cr%5Cn%27%29">reload</a> the page'
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
--