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...



Please any ideas is welcome... thanks for your help,

Cheers,

Reply via email to