On Thu, Jun 3, 2010 at 03:00, Yannick <[email protected]> wrote: > Hello mate. > I can't upload in this situation below: > > Here is the view: > <script type="text/javascript"> > ... > mainImage = $(".image-wrapper").HandlerFile( > { > mainImageUrl: "", > helper: $("#tooltip"), > ... > } > ... > </script> > <h3>Upload Pictures. You can upload up to 10 pictures at once.</h3> > {{=upload.custom.begin}} > <input id="fileInputUpload" class="multi" maxlength="10" > name="fileupload" type="file" accept="gif|jpg|png" /> > <input id="uploadbtn" type="submit" value="Upload" /> > {{=upload.custom.end}} > > <div class="image-wrapper current" style="opacity: 1; cursor: > crosshair; position: relative; border: solid 1px black; float: > left;"></div> > ... > ... > ######### > Controller > ######### > ... > # this is a customize function > form=multicrud.create(db.photo, > message = 'file(s) uploaded', > multiUpload='fileupload', > onaccept = clearPictureCache, > multiUploadFilename= 'photoname',#'filename', > multiMaxFiles=10, > next= URL(r=request,c='BuTagCenter', f='index') ) > ... > return dict(upload = form) > > ################# > When debugging I noticed that the accepts() function from "html.py" > was failing because the "request_vars._formkey" is different from the > "session.get('_formkey[%s]'% self.formname)". > > And when I remove this from the view > " > mainImage = $(".image-wrapper").HandlerFile( > { > mainImageUrl: "", > helper: $("#tooltip"), > ... > }" > everything work well... the validation is perfect in the "html.py" > and the file is uploaded successfully... > > So I wonder WHY this > "mainImage = $(".image-wrapper").HandlerFile( > { > mainImageUrl: "", > helper: $("#tooltip"), > ... > }" > is affecting the form key variables that is send to the server ??? I'm > really surprise by this since it shouldn't related...
What HandlerFile() does? Did you check with Firebug (or other tool) what is done (if it changes the form name, input names/classes/ids etc.) when you execute this function? A little tip: remote this code from your code and then execute only this line on Firebug's console when the page is loaded, so you can "see" what happens. -- Álvaro Justen - Turicas http://blog.justen.eng.br/ 21 9898-0141

