我使用krajee插件使用ajax上传多个图像但是什么时候 我尝试用它上传额外的数据,以便根据保存额外的数据 多个图像的数量,如果图像是三个这样的用户 名称也保存了三次。 代码低于
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
$("#image").fileinput({
uploadUrl: "{{route('saveUser')}}", // server upload action
uploadAsync: true,
minFileCount: 1,
maxFileCount: 50,
overwriteInitial: true,
data: {'_token': "{{csrf_token()}}"},
initialPreviewAsData: true, // identify if you are sending preview data only and not the raw markup
initialPreviewFileType: 'image', // image is the default and can be overridden in config below
initialPreviewConfig: [
{caption: "People-1.jpg", size: 576237, width: "120px", url: "/site/file-delete", key: 1},
{caption: "People-2.jpg", size: 932882, width: "120px", url: "/site/file-delete", key: 2},
],
uploadExtraData: function() {
return {
// img_key: "1000",
// img_keywords: "happy, places",
cycle: $("#cycle").val(),
description: $("#description").val()
// user_id: $("#user_id").val()
};
}
});
</script>