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. leetcode 1282. Group the People Given the Group Size They Belong To

    There are n people whose IDs go from 0 to n - 1 and each person belongs exactly to one group. Given ...

  2. 为什么日本编程语言ruby没前途

    ruby是日本的编程语言,不像日本生鱼片一样受人喜欢 日本 Ruby的性能不如.NET或Java 你又是对的!另外,Ruby比Erlang,Lua,C ++等慢,但你不使用Erlang或C ++? W ...

  3. dubbo学习笔记四(异步调用)

    相关资料 官方文档 项目结构 代码示例 [EchoTestApp] @RestController @SpringBootApplication @ImportResource("class ...

  4. RAD Studio 10 up1欢迎页证书不可用

    不只是欢迎页,每打开一个新的工程,都会出现上面那个证书不可用的提示. 解决方法: 1.通过Fiddler网络监控软件分析发现,出现这个问题的原因是bds启动的时候会用https协议访问谷歌的统计服务器 ...

  5. 6.redis

    1.Redis的安装以及客户端连接 安装:apt-get install redis-server 卸载:apt-get purge --auto-remove redis-server 启动:red ...

  6. CentOS 7.x and RHEL 7.x Install qemu-kvm

    ref: https://www.linuxtechi.com/install-kvm-hypervisor-on-centos-7-and-rhel-7/        https://www.th ...

  7. TP5 中的redis 队列

    首先我们看一下自己的TP5的框架中的  TP5\vendor\topthink ,这个文件中有没有think-queue这个文件夹,如果没有请安装, 安装这个是要用到Composer的如果没有安装co ...

  8. 动画学习之WIFI图形绘制

    Android原生动画概述: 对于APP开发中涉及到的一些动画基本上都可以用Android提供的各种原生动画类来实现,所以在学习自定义动画之前首先来对原生动画进行一个基本的了解,这里不详细对每一个原生 ...

  9. js实现计时 时分秒

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. django RBAC类

    # -*- coding: utf-8 -*- ''' @author: Swain @contact: 624420781@qq.com @file: middlewares.py @time: 2 ...