[web2py] how to use this ajax upload script with web2py?

2011-06-10 Thread danto
http://valums.com/ajax-upload/

It's supposed to be a ready-to-use asyncronous upload (could be a widget,
later) with load indicator, but I don't know how to integrate with my form.
In fact, I get no errors on console (as the author say after set debug:
true) but still my upload fails. I can tested with rocket and
apache+mod_wsgi, but probably should blame my implementation:

### CONTROLLER:
def post():
response.files.append(URL('static','css/fileuploader.css'))
response.files.append(URL('static','js/fileuploader.js'))
form = SQLFORM.factory(
Field('nombre'),
Field('archivo','upload',uploadfolder='applications/test/uploads')
)

if form.accepts(request.vars,session):
response.flash = 'ok'
elif form.errors:
response.flash = 'no'
return locals()


### VIEW:

{{extend 'layout.html'}}


Please enable JavaScript to use file uploader.




{{=response.toolbar()}}


var uploader = new qq.FileUploader({
// pass the dom node (ex. $(selector)[0] for jQuery users)
element: document.getElementById('fileuploader'),
// path to server-side upload scripts
action: 'post',
debug: true,
});


thank you for your time


Re: [web2py] how to use this ajax upload script with web2py?

2011-06-11 Thread Dr Schmulge
Take a slice )
http://web2pyslices.com/main/slices/take_slice/103

2011/6/11 danto :
> http://valums.com/ajax-upload/
>
> It's supposed to be a ready-to-use asyncronous upload (could be a widget,
> later) with load indicator, but I don't know how to integrate with my form.
> In fact, I get no errors on console (as the author say after set debug:
> true) but still my upload fails. I can tested with rocket and
> apache+mod_wsgi, but probably should blame my implementation:
>
> ### CONTROLLER:
> def post():
>     response.files.append(URL('static','css/fileuploader.css'))
>     response.files.append(URL('static','js/fileuploader.js'))
>     form = SQLFORM.factory(
>     Field('nombre'),
>     Field('archivo','upload',uploadfolder='applications/test/uploads')
>     )
>
>     if form.accepts(request.vars,session):
>     response.flash = 'ok'
>     elif form.errors:
>     response.flash = 'no'
>     return locals()
>
>
> ### VIEW:
>
> {{extend 'layout.html'}}
> 
>     
>     Please enable JavaScript to use file uploader.
>     
>     
> 
>
> {{=response.toolbar()}}
>
> 
> var uploader = new qq.FileUploader({
>     // pass the dom node (ex. $(selector)[0] for jQuery users)
>     element: document.getElementById('fileuploader'),
>     // path to server-side upload scripts
>     action: 'post',
>     debug: true,
> });
> 
>
> thank you for your time
>


Re: [web2py] how to use this ajax upload script with web2py?

2011-06-11 Thread danto
2011/6/11 Dr Schmulge 

> Take a slice )
> http://web2pyslices.com/main/slices/take_slice/103
>

omg, ty! :)