This is a repost cause it did not receive much feedback.
I have noticed an error in the code below. The book emphasises on upload
file storage in the db, but what about simple upload and manipulation.
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", uploadfolder=os.path.join(request.folder, 'uploads'))) test = ''
first_name = '' if request.vars.first_name: first_name = "My test" if
request.vars.quotes_file: test = "My File"
return locals()
View: ==============
{{extend 'layout.html'}}<br> File: {{=test}}<br>
First name: {{=first_name}} {{=form}} {{=BEAUTIFY(request.vars)}}
When i submit the form with a file attached the beautify displays the file
content and the value for first_name.
But, the value for "test" = "My File" is not being displayed in the view,
while the "first_name" = "My test" is being displayed without any problem.
I have further noticed this error in the page source after making a submit:
<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?
--
---
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.