On Mar 8, 5:31 pm, mdipierro <[email protected]> wrote:
> > This doesn't handle JSON upload at all does it?
> I think it does. Can you provide an example of what you mean?

What I'm trying to do is to upload data into my Web2Py application's
database from JavaScript.
Ideally this would be to the forms created by Crud (since this handles
validation).
I'm not sure this is possible though?
- e.g. do I have to be able to provide the hidden _formkey var?

I see that the forms use POST & multipart/form-data.
So using jQuery-1.3.2 I'm trying (http://docs.jquery.com/Ajax/
jQuery.ajax#options):
$.ajax({ type: "POST", contentType: "multipart/form-data",
                    url: "{{=URL
(r=request,c='cr',f='shelter',args='create')}}",
                    data: { name: "MyShelter", _formname:
"cr_shelter" }
               });

This gives me:
Traceback (most recent call last):
  File "C:\Bin\web2py\gluon\main.py", line 269, in wsgibase
    environ=environ, keep_blank_values=1)
  File "c:\bin\python25\lib\cgi.py", line 534, in __init__
    self.read_multi(environ, keep_blank_values, strict_parsing)
  File "c:\bin\python25\lib\cgi.py", line 650, in read_multi
    raise ValueError, 'Invalid boundary in multipart form: %r' % (ib,)
ValueError: Invalid boundary in multipart form: ''

Not sure if this is a Web2Py or jQuery issue.

I've also been experimenting with Curl, but that requires me to save
the session in a cookie (OK) & the submit button doesn't have a name
to reference it (http://curl.haxx.se/docs/httpscripting.html)


Since I've been having problems with the Crud forms, I have developed
a custom controller function, which now requires me to reimplement all
the validation myself....since this is being done within a generic
CRUD controller, I'm not sure if I can get all the requires statements
from the model unless I store them inside a Storage() global variable?


Any help very much welcomed :)

F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to