Krajee Bootstrap文件输入因大文件而失败

时间:2018-05-17 08:11:23

标签: image-processing file-upload image-uploading mime-types bootstrap-file-upload

我正在使用krajee file input上传图片。它适用于小图像。但它无法上传大图像。当我在服务器端检查请求时,小图片有mimeType=image/jpeg,大图片有mimeType=application/octet-stream size=0这是我的文件上传器配置。

$("#file-4").fileinput({
theme: 'fa',
uploadUrl: uploadUrl,
allowedFileExtensions: ['jpg', 'png', 'gif', 'jpeg'],
overwriteInitial: false,
maxFileSize: 12500,
maxFilesNum: 4,
showCaption:false,
rtl: true,
showRemove: false,
showUpload: false,
showCancel: true,
browseOnZoneClick: true,
initialPreview: imageData,
initialPreviewConfig: JSON.parse(unescape(configData)),
deleteUrl: 'http://localhost:8000/ajax/upload/image/delete?fileName=' + $('#fileName').val(),
deleteExtraData: {file: this.key},
initialPreviewThumbTags: tags,
browseLabel: 'Upload Images',
layoutTemplates: {
    footer: footerTemplate,
    actions: actionsTemp
},
uploadExtraData: {
    folder: $('#folder').val()
}
});

1 个答案:

答案 0 :(得分:1)

类似地,问题出在服务器端设置,例如php.ini中。

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

两者均应设置为要上传的最大大小以上。