首页 > 解决方案 > 使用 Blueimp 上传 +cropper.js 上传一些文件的问题

问题描述

我有一个系统,用户可以将一些照片发送到服务器,客户端接收它来制作它们的宝丽来版本。

用户可以选择是否裁剪它们。

我使用 Blueimp ( https://github.com/blueimp/jQuery-File-Upload ) 上传图像和cropper.js ( https://fengyuanchen.github.io/cropperjs/ ) 来裁剪它们。

但是有些用户抱怨有些文件没有上传,但没有显示错误。

不是扩展名,不是大小...我不知道可能是什么问题...

在这个文件(jquery.fileupload-ui.js)中,我找到了一行代码,如果我删除它,它可以工作,但我看不到文件的缩略图。但文件已上传。是 always 函数之前的最后一行。

add: function (e, data) {
if (e.isDefaultPrevented()) {
    return false;
}


var $this = $(this),
that = $this.data('blueimp-fileupload') ||
$this.data('fileupload'),
options = that.options;

data.context = that._renderUpload(data.files)
.data('data', data)
.addClass('processing');

options.filesContainer[
options.prependFiles ? 'prepend' : 'append'
](data.context);
that._forceReflow(data.context);
that._transition(data.context);
data.process(function () {

    // return $this.fileupload('process', data);

}).always(function () {
    data.context.each(function (index) {
        $(this).find('.size').text(
            that._formatFileSize(data.files[index].size)
            );
    }).removeClass('processing');
    that._renderPreviews(data);
}).done(function () {
    data.context.find('.start').prop('disabled', false);
    if ((that._trigger('added', e, data) !== false) &&
        (options.autoUpload || data.autoUpload) &&
        data.autoUpload !== false) {
        data.submit();
}
}).fail(function () {
    if (data.files.error) {
        data.context.each(function (index) {
            var error = data.files[index].error;
            if (error) {
                $(this).find('.error').text(error);
            }
        });
    }
});

标签: phpserverjquery-file-uploadblueimpcropperjs

解决方案


推荐阅读