以https://github.com/blueimp/jQuery-File-Upload/blob/master/basic-plus.html为例

注释掉load-image.all.min.js

<!--script src="//blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script-->

jquery.fileupload-image.js:279 Uncaught TypeError: Cannot read property 'parseMetaData' of undefined
at $.<computed>.<computed>.loadImageMetaData (jquery.fileupload-image.js:279)
at $.<computed>.<computed>.func (jquery.fileupload-process.js:84)
at $.<computed>.<computed>.<anonymous> (jquery.js:3305)
at fire (jquery.js:3148)
at Object.add [as done] (jquery.js:3194)
at Array.<anonymous> (jquery.js:3304)
at Function.each (jquery.js:384)
at Object.<anonymous> (jquery.js:3301)
at Function.Deferred (jquery.js:3361)
at Object.then (jquery.js:3300)

jquery.fileupload-process.js:84

_processFile: function (data, originalData) {这个函数中
return that.processActions[settings.action].call(
that,
data,
settings
);

jquery.fileupload-process.js:153

_processFile函数,被process函数调用

// Processes the files given as files property of the data parameter,
// returns a Promise object that allows to bind callbacks:
process: function (data) {
$.each(data.files, function (index) {
var opts = index ? $.extend({}, options) : options,
func = function () {
if (data.errorThrown) {
return $.Deferred()
.rejectWith(that, [data]).promise();
}
return that._processFile(opts, data);
};

jquery.fileupload.js:217

// The add callback is invoked as soon as files are added to the fileupload
// widget (via file input selection, drag & drop, paste or add API call).
// If the singleFileUploads option is enabled, this callback will be
// called once for each file in the selection for XHR file uploads, else
// once for each file selection.
//
// The upload starts when the submit method is invoked on the data parameter.
// The data object contains a files property holding the added files
// and allows you to override plugin options as well as define ajax settings.
//
// Listeners for this callback can also be bound the following way:
// .bind('fileuploadadd', func);
//
// data.submit() returns a Promise object and allows to attach additional
// handlers using jQuery's Deferred callbacks:
// data.submit().done(func).fail(func).always(func);
add: function (e, data) {
if (e.isDefaultPrevented()) {
return false;
}
if (data.autoUpload || (data.autoUpload !== false &&
$(this).fileupload('option', 'autoUpload'))) {
data.process().done(function () {
data.submit();
});
}
},

先执行$(this).fileupload('option', 'autoUpload'),触发了jquery.ui.widget.js中的代码

var widget_uuid = 0,
widget_slice = Array.prototype.slice;
$.fn[ name ] = function( options ) {
//对三个变量进行赋值
var isMethodCall = typeof options === "string",
args = widget_slice.call( arguments, 1 ),
returnValue = this;

这里的name是fileupload,options是option

arguments有2个元素, 0:option, 1:autoUpload

args经过赋值之后是autoUpload

if ( isMethodCall ) {
this.each(function() {
var methodValue,
instance = $.data( this, fullName );

fullName是blueimp-fileupload

经过赋值后

data函数调用触发了jquery中的函数

data: function( elem, name, data ) {
return internalData( elem, name, data );
},

elem是id为fileupload的input控件

name是blueimp-fileupload

经过赋值后,instance是fileupload的一个对象,这个对象包含一些数组元素,比如option

if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}

instance[options]是一个函数,这个函数是jquery.ui.widget.js中定义的,因为blueimp-fileupload扩展了,所以blueimp-fileupload也包含这么一个函数

option: function( key, value ) {
var options = key,
parts,
curOption,
i;
args经过赋值之后是autoUpload
methodValue = instance[ options ].apply( instance, args );

因为上面的apply调用只传递了一个参数autoUpload

option: function( key, value ) {
var options = key,
parts,
curOption,
i;

else {
if ( arguments.length === 1 ) {
return this.options[ key ] === undefined ? null : this.options[ key ];
}

返回的methodValue是false

jQuery file upload上传图片出错分析的更多相关文章

  1. jQuery file upload上传图片的流程

    先触发_onChange[jquery.fileupload.js] _onChange: function (e) { var that = this, data = { fileInput: $( ...

  2. jQuery File Upload 插件 php代码分析

    jquery file upload php代码分析首先进入构造方法 __construct() 再进入 initialize()因为我是post方式传的数据  在进入initialize()中的po ...

  3. jQuery File Upload done函数没有返回

    最近在使用jQuery File Upload 上传图片时发现一个问题,发现done函数没有callback,经过一番折腾,找到问题原因,是由于dataType: ‘json’造成的,改为autoUp ...

  4. 用jQuery File Upload做的上传控件demo,支持同页面多个上传按钮

    需求 有这么一个需求,一个form有多个文件要上传,但又不是传统的图片批量上传那种,是类似下图这种需求,一开始是用的swfupload做的上传,但是问题是如果有多个按钮的话,就要写很多重复的代码,于为 ...

  5. jQuery File Upload blueimp with struts2 简单试用

    Official Site的话随便搜索就可以去了 另外新版PHP似乎都有问题  虽然图片都可以上传  但是response报错  我下载的是8.8.7木有问题   但是8.8.7版本结合修改main. ...

  6. jQuery File Upload 单页面多实例的实现

    jQuery File Upload 的 GitHub 地址:https://github.com/blueimp/jQuery-File-Upload 插件描述:jQuery File Upload ...

  7. jQuery File Upload文件上传插件简单使用

    前言 开发过程中有时候需要用户在前段上传图片信息,我们通常可以使用form标签设置enctype=”multipart/form-data” 属性上传图片,当我们点击submit按钮的时候,图片信息就 ...

  8. jquery file upload示例

    原文链接:http://blog.csdn.net/qq_37936542/article/details/79258158 jquery file upload是一款实用的上传文件插件,项目中刚好用 ...

  9. jquery file upload + asp.net 异步多文件上传

    百度了很久,国内一直 找不到 使用jquery file upload 插件 +asp.net 的相关代码 一开始使用 jquery uploadify ,一款基于 flash的插件,但是不支持 Sa ...

随机推荐

  1. 模板 - 强连通分量 - Kosaraju

    Kosaraju算法 O(n+m) vector<int> s; void dfs1(int u) { vis[u] = true; for (int v : g[u]) if (!vis ...

  2. RocketMQ吐血总结

    RocketMQ吐血总结 架构 概念模型 最基本的概念模型与扩展后段概念模型 存储模型 RocketMQ吐血总结 User Guide RocketMQ是一款分布式消息中间件,最初是由阿里巴巴消息中间 ...

  3. 腾讯万亿级分布式消息中间件TubeMQ正式开源

    TubeMQ是腾讯在2013年自研的分布式消息中间件系统,专注服务大数据场景下海量数据的高性能存储和传输,经过近7年上万亿的海量数据沉淀,目前日均接入量超过25万亿条.较之于众多明星的开源MQ组件,T ...

  4. const关键字 C与C++分析

    1 C与C++的区别 1.1.C允许定义两个变量名相同的变量,而C++不允许. 在C语言中是允许定义两个名字相同的全局变量.  在C++中是不允许定义两个名字相同的全局变量. 测试代码: /* 编译环 ...

  5. wpf prism加载独立模块实例

    一.首先看看文件的组织架构 module1 module2生成dll某块.Shell来显示管理模块 二,看看关键bootstrapper类 using System;using System.Coll ...

  6. openapi

    https://www.breakyizhan.com/swagger/2810.html https://www.cnblogs.com/serious1529/p/9318115.html htt ...

  7. Fiddler抓包的简单使用

    Fiddler抓包的简单使用 参考的博客文章:玲虫师的<Fiddler抓包[5]_Fiddler过滤>. (1)使用fiddler进行过滤,只抓取需要的网络请求. 点击右侧菜单中的[Fil ...

  8. Linux查看某进程的线程

    首先得知道你要查的进程的PID: 比如我要查看看我unimrcpserver的线程 第二种方法:top top命令可以实时显示各线程情况.就相当于windows的资源管理器.

  9. 【leetcode】1228.Missing Number In Arithmetic Progression

    题目如下: 解题思路:题目很简单.先对数组排序,根据最大值和最小值即可求出公差,然后遍历数组,计算相邻元素的差,如果差不等于公差,即表示数字缺失. 代码如下: class Solution(objec ...

  10. Linux系统如何选择MongoDB版本

    mogodb各个版本该怎么选: 如下图所示,我们可以看到有许多版本的安装包,那我们选择下载哪个呢?下面我会讲解一下: 我们发现主要有6种,分别是 : Amazon Linux(亚马逊). Debian ...