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>
        <p>Please 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

Reply via email to