Using jQuery File Upload (UI version) with a custom server-side upload handler

正常的返回结果,即上传文件成功

Extend your custom server-side upload handler to return a JSON response akin to the following output:

{"files": [
{
"name": "picture1.jpg",
"size": 902604,
"url": "http:\/\/example.org\/files\/picture1.jpg",
"thumbnailUrl": "http:\/\/example.org\/files\/thumbnail\/picture1.jpg",
"deleteUrl": "http:\/\/example.org\/files\/picture1.jpg",
"deleteType": "DELETE"
},
{
"name": "picture2.jpg",
"size": 841946,
"url": "http:\/\/example.org\/files\/picture2.jpg",
"thumbnailUrl": "http:\/\/example.org\/files\/thumbnail\/picture2.jpg",
"deleteUrl": "http:\/\/example.org\/files\/picture2.jpg",
"deleteType": "DELETE"
}
]}

上传失败,出现错误

To return errors to the UI, just add an error property to the individual file objects:

{"files": [
{
"name": "picture1.jpg",
"size": 902604,
"error": "Filetype not allowed"
},
{
"name": "picture2.jpg",
"size": 841946,
"error": "Filetype not allowed"
}
]}

删除文件

When removing files using the delete button, the response should be like this:

{"files": [
{
"picture1.jpg": true
},
{
"picture2.jpg": true
}
]}

Note that the response should always be a JSON object containing a files array even if only one file is uploaded.

Visit the uploaded directory - you should see the same file upload interface as in the demo, allowing you to upload files to your website.

jQuery file upload 服务端返回数据格式的更多相关文章

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

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

  2. jQuery File Upload

    jQuery File Upload介绍.............................................. 2 实现基本原理......................... ...

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

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

  4. 定制jQuery File Upload为微博式单文件上传

    日志未经声明,均为AlloVince原创.版权采用『 知识共享署名-非商业性使用 2.5 许可协议』进行许可. jQuery File Upload是一个非常优秀的上传组件,主要使用了XHR作为上传方 ...

  5. jquery file upload使用

    <!-- jquery file upload相关js --> <script src="/js/jquery-file-upload/js/jquery.ui.widge ...

  6. jQuery File Upload 文件上传插件使用一 (最小安装 基本版)

    jQuery File Upload 是一款非常强大的文件上传处理插件,支持多文件上传,拖拽上传,进度条,文件验证及图片音视频预览,跨域上传等等. 可以说你能想到的功能它都有.你没想到的功能它也有.. ...

  7. js插件---WebUploader 如何接收服务端返回的数据

    js插件---WebUploader 如何接收服务端返回的数据 一.总结 一句话总结: uploadSuccess有两个参数,一个是file(上传的文件信息),一个是response(服务器返回的信息 ...

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

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

  9. jQuery File Upload 图片上传解决方案兼容IE6+

    1.下载:https://github.com/blueimp/jQuery-File-Upload 2.命令: npm install bower install ================= ...

随机推荐

  1. U盘重装系统

    一.准备工作 (1)8G以上空间的U盘一个: (2)将U盘制作好启动工具: 1.下载启动工具制作软件(常用的有:大白菜.电脑店.老毛桃.快启动等等一系列软件,直接百度这些软件的名称,或者百度U盘启动制 ...

  2. ccs之经典布局(三)(等分,等高布局)

    接上篇ccs之经典布局(二)(两栏,三栏布局) 七.等分布局 等分布局是指一行被分为若干列,每一列的宽度是相同的值.两列之间有若干的距离. 1.float+padding+background-cli ...

  3. vue路由(基于VScode开发)

    index.js如果在router目录下,代表这个js文件只是路由使用 main.js中为全局,需要引入使用到的组件,一般vue中不用写东西vue中el挂载哪个就哪个组件为根目录,传值数据绑定的时候在 ...

  4. 爬虫之如何找js入口(一)

    目标网页:https://m.gojoy.cn/pages/login/ 将我删除i ndex?from=%2Fpages%2Fuser%2Findex 需要工具:chrome和油猴 油猴代码: // ...

  5. MySQL字段值按照拼音首字母排序

    最简单.快速的方法: 将需要进行排序的字段编码设置为GBK,然后在查询时直接使用asc/desc就可以啦

  6. SQLServer中跨服务器跨数据库之间的数据操作

    首先必须理解一个概念: select * from sys.servers         (查看系统表,看原来的服务器名) 要想跨域就必须在以上信息中可以检索到! 怎样添加? --创建链接服务器  ...

  7. win7安装xmanager报错error1303、err1317

    安装xmanager时出现的一些问题,记录如下. 1.安装xmanager时,提示error1303.如下图,按照百度的办法,创建相应的文件夹后,点击重试. 2.重试后提示err1317,如下图所示. ...

  8. 模拟赛小结:2017-2018 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2017)

    比赛链接:传送门 本场我们队过的题感觉算法都挺简单的,不知道为啥做的时候感觉没有很顺利. 封榜后7题,罚时1015.第一次模拟赛金,虽然是北欧的区域赛,但还是有点开心的. Problem B Best ...

  9. npm上发布vue插件

    1.初始化项目 vue init webpack-simple XXXXX(此处为插件名) 使用vue创建一个简单的项目,删除src中除了main.js和app.vue外的文件,清空app.vue中无 ...

  10. vsftpd 添加用户

    方法/步骤     首先要添加一个新的ftp用户并添加访问路径 useradd -d /alidata/www/ace ceshi        -d是用户的访问目录   为新添加的ftp用户设置密码 ...