J'essaye de télécharger le fichier avec jqgrid, mais c'est une erreur dans mon code. J'utilise la méthode onInitializeForm. J'utilise Jquery Ajax File Uploader Quelqu'un peut-il m'aider? Vous pouvez voir Erreur dans la capture d'écranJqGrid: Le téléchargement de fichier ne fonctionne pas
Ceci est mon code.
jQuery("#formGrid").jqGrid(
{
url:'application/ajax/common_form_detail.php?form_id='+form_id,
editurl:'application/ajax/common_form_edit.php?form_id='+form_id,
datatype: "json",
colNames:[<?php echo $strfield; ?>],
colModel:[<?php echo $strFieldModel; ?>],
rowNum:20,
rowList:[20,50,100],
pager: '#formControl',
sortname: 'id',
viewrecords: true,
sortorder: "asc",
autowidth: true,
height: 400,
width: 900
});
jQuery("#formGrid").jqGrid('navGrid','#formControl',
{ edit:true,add:true,del:true,search:false},
{width:780,recreateForm:true},
{width:780,recreateForm:true
,onInitializeForm : function(formid){
$(formid).attr('method','POST');
$(formid).attr('action','');
$(formid).attr('enctype','multipart/form-data');
}, afterSubmit : function(response, postdata){
$.ajaxFileUpload({
url: 'application/ajax/common_file_upload.php',
secureuri:false,
fileElementId:'STUDENT_AVATAR',
dataType: 'json',
success: function (data, status) {
alert("Upload Complete.");
}
});
}
});
});
y at-il un plugin pour télécharger plusieurs images? –
@ShamseerKSmr: Désolé, mais je n'ai jamais utilisé de plugin de téléchargement de fichiers dans de vrais projets. Regardez http://www.plupload.com/ et https://github.com/moxiecode/plupload. Il semble être un plugin puissant pour le téléchargement de fichiers. On devrait être capable de télécharger plusieurs fichiers aussi. Il peut être utilisé de différentes manières. J'espère que ça t'aidera. – Oleg