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

2011-06-12 Thread danto
2011/6/11 Dr Schmulge dr.schmu...@gmail.com

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


omg, ty! :)


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 web2py.n...@gmail.com:
 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'}}
 div id=fileuploader
     noscript
     pPlease enable JavaScript to use file uploader./p
     !-- or put a simple form for upload here --
     /noscript
 /div

 {{=response.toolbar()}}

 script
 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,
 });
 /script

 thank you for your time



[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'}}
div id=fileuploader
noscript
pPlease enable JavaScript to use file uploader./p
!-- or put a simple form for upload here --
/noscript
/div

{{=response.toolbar()}}

script
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,
});
/script

thank you for your time