jQuery File Upload 是一个Jquery图片上传组件,支持多文件上传、取消、删除,上传前缩略图预览、列表显示图片大小,支持上传进度条显示;支持各种动态语言开发的服务器端。

jQuery File Upload有多个文件选择,拖放上传控件拖放支持,进度条,验证和预览图像,音频和视频 。

支持跨域,分块和可恢复的文件上传和客户端图像大小调整。适用于任何服务器端平台(PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) ,支持标准的HTML表单文件上传。

产品特点

多文件上传:

允许选择多个文件一次,并将其上传同时进行。

  • 拖放支持:
  • 可以从您的桌面或文件管理器中拖放他们在您的浏览器窗口中上传文件。
  • 上传进度条:
  • 显示一个进度条显示为单独的文件和所有上传组合上传进度。
  • 可取消上传:
  • 单个文件上传可以取消来停止上传进度。
  • 可恢复上传:
  • 中止的上传可以与浏览器支持的Blob API进行恢复。
  • 分块上传:
  • 大文件可以上传较小的块与浏览器支持的Blob的API 。
  • 客户端图像大小调整:
  • 图像可以自动调整大小的客户端与浏览器支持所需的JS API的。
  • 预览图像,音频和视频:
  • 图像,音频和视频文件的预览可以与浏览器支持所需的API上传前显示。
  • 没有浏览器插件(例如使用Adobe的Flash )要求:
  • 该实现是基于开放的标准,如HTML5和JavaScript的,不需要额外的浏览器插件。
  • 优美的后备旧版的浏览器:
  • 如果支持的话,使用内置页框作为后备旧版浏览器通过的XMLHttpRequest上传文件。
  • HTML文件上传表单回退:
  • 通过使用标准的HTML文件上传表单的控件元素允许渐进增强。
  • 跨站点的文件上传:
  • 支持上传文件到不同的域与跨站点的XMLHttpRequest或iframe重定向。
  • 多个插件实例:
  • 允许使用在同一个网页上的多个插件实例。
  • 可定制和可扩展的:
  • 提供了一个API来设置各个选项,并定义回调方法的各种载事件。
  • 多重和文件内容流上传:
  • 文件可以被上传为标准的“多部分/窗体的数据”或文件内容流( HTTP PUT文件上传) 。
  • 兼容任何服务器端应用平台:
  • 适用于任何服务器端平台(PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) ,支持标准的HTML表单文件上传。

所有可触发的函数

$(<span class="hljs-string">"#fileupload"</span>).fileupload({
        acceptFileTypes : <span class="hljs-regexp">/jp?g/i</span>,
        maxFileSize : <span class="hljs-number">3</span> * <span class="hljs-number">1000</span> * <span class="hljs-number">1000</span> * <span class="hljs-number">1000</span>
    }).bind(<span class="hljs-string">'fileuploadadd'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadadd'</span>);
    }).bind(<span class="hljs-string">'fileuploadsubmit'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadsubmit'</span>);
    }).bind(<span class="hljs-string">'fileuploadsend'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadsend'</span>);
    }).bind(<span class="hljs-string">'fileuploaddone'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploaddone'</span>);
    }).bind(<span class="hljs-string">'fileuploadfail'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadfail'</span>);
    }).bind(<span class="hljs-string">'fileuploadalways'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadalways'</span>);
    }).bind(<span class="hljs-string">'fileuploadprogress'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprogress'</span>);
    }).bind(<span class="hljs-string">'fileuploadprogressall'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprogressall'</span>);
    }).bind(<span class="hljs-string">'fileuploadstart'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadstart'</span>);
    }).bind(<span class="hljs-string">'fileuploadstop'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadstop'</span>);
    }).bind(<span class="hljs-string">'fileuploadchange'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadchange'</span>);
    }).bind(<span class="hljs-string">'fileuploadpaste'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadpaste'</span>);
    }).bind(<span class="hljs-string">'fileuploaddrop'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploaddrop'</span>);
    }).bind(<span class="hljs-string">'fileuploaddragover'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e)</span> {</span>
        console.log(<span class="hljs-string">'fileuploaddragover'</span>);
    }).bind(<span class="hljs-string">'fileuploadchunksend'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadchunksend'</span>);
    }).bind(<span class="hljs-string">'fileuploadchunkdone'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadchunkdone'</span>);
    }).bind(<span class="hljs-string">'fileuploadchunkfail'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadchunkfail'</span>);
    }).bind(<span class="hljs-string">'fileuploadchunkalways'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadchunkalways'</span>);
    }).bind(<span class="hljs-string">'fileuploadprocessstart'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprocessstart'</span>);
    }).bind(<span class="hljs-string">'fileuploadprocess'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprocess'</span>);
    }).bind(<span class="hljs-string">'fileuploadprocessdone'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprocessdone'</span>);
    }).bind(<span class="hljs-string">'fileuploadprocessfail'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprocessfail'</span>);
    }).bind(<span class="hljs-string">'fileuploadprocessalways'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprocessalways'</span>);
    }).bind(<span class="hljs-string">'fileuploadprocessstop'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadprocessstop'</span>);
    }).bind(<span class="hljs-string">'fileuploaddestroy'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploaddestroy'</span>);
    }).bind(<span class="hljs-string">'fileuploaddestroyed'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploaddestroyed'</span>);
    }).bind(<span class="hljs-string">'fileuploadadded'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadadded'</span>);
    }).bind(<span class="hljs-string">'fileuploadsent'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadsent'</span>);
    }).bind(<span class="hljs-string">'fileuploadcompleted'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadcompleted'</span>);
    }).bind(<span class="hljs-string">'fileuploadfailed'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadfailed'</span>);
    }).bind(<span class="hljs-string">'fileuploadfinished'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e, data)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadfinished'</span>);
    }).bind(<span class="hljs-string">'fileuploadstarted'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadstarted'</span>);
    }).bind(<span class="hljs-string">'fileuploadstopped'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(e)</span> {</span>
        console.log(<span class="hljs-string">'fileuploadstopped'</span>);
    });