下载地址:http://www.uploadify.com/wp-content/uploads/files/uploadify.zip

相关配置:http://www.uploadify.com/documentation/

一、 html 上传页面:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="__STATIC__/static/uploadify/uploadify.css"/>
</head>
<body>
<input type="file" name="file_upload" id="file_upload" />
<img id="img" src=""/>
</body>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="__STATIC__/static/uploadify/jquery.uploadify.min.js"></script>
<script>
    $(function() {
        $("#file_upload").uploadify({
            'swf'             : '__STATIC__/static/uploadify/uploadify.swf',
            'uploader'        : '{:url("/file")}',
            'fileObjName'     : 'the_files',
            'buttonText'      : '图片上传',
            'onUploadSuccess' : function(file, data, response) {
                if(response){
                    var obj=JSON.parse(data);
                    $('#img').attr('src',obj.data);
                    $('#img').attr('width','200px;');
                    $('#img').attr('height','200px;');
                }
            }
        });
    });
</script>
</html>

二、路由文件:

<?php
use think\Route;
//上传页面
Route::rule('map','index/Index/index','GET');
//接受上传页面
Route::rule('file','api/Upload/index','POST');

三、api/Upload/index 方法:

<?php

namespace app\api\controller;

use think\Controller;
use think\Request;

class Upload extends Controller
{

    public function index()
    {
        $file=request()->file('the_files');
        $info = $file->move('uploads');
        if($info){
            return [
                'status'=> 1,
                'message'=>'success',
                'data'=>DS.$info->getPathname()
            ];
        }else{
            // 上传失败获取错误信息
            echo $file->getError();
        }
    }

}

效果:

结束。

《五》uploadify插件上传文件的更多相关文章

  1. 用jquery uploadify上传插件上传文件

    public void ProcessRequest(HttpContext context) { string esOIDs = System.Web.HttpContext.Current.Req ...

  2. 完整uploadify批量上传文件插件使用

    1.首先准备uploadify的js文件,网上一搜一大堆 2.上传页面UpFilePage.aspx 关键代码: <html xmlns="http://www.w3.org/1999 ...

  3. uploadify前台上传文件,java后台处理的例子

    1.先创建一个简单的web项目upload (如图1-1) 2.插件的准备 (1).去uploadify的官网下载一个uploadify插件,然后解压新建个js文件夹放进去(这个不强求,只要路径对了就 ...

  4. Extjs 使用fileupload插件上传文件 带进度条显示

    一.首先我们看看官方给出的插件的解释: 一个文件上传表单项具有自定义的样式,并且可以控制按钮的文本和 像文本表单的空文本类似的其他特性. 它使用一个隐藏的文件输入元素,并在用户选择文件后 在form提 ...

  5. uploadify+批量上传文件+java

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  6. 在Struts2中使用Uploadify组件上传文件

    Uploadify是一个基于Jquery的文件上传组件,官网http://www.uploadify.com/可以在官网获得该组件,运行演示示例,下载帮助文档.     作为Web前端的增强技术,Jq ...

  7. fileInput插件上传文件

    一.ftl <form action="" method="post" name="form" id="form" ...

  8. 菜鸟学SSH(五)——Struts2上传文件

    上传文件在一个系统当中是一个很常用的功能,也是一个比较重要的功能.今天我们就一起来学习一下Struts2如何上传文件. 今天讲的上传文件的方式有三种: 1,以字节为单位传输文件: 2,Struts2封 ...

  9. asp.net配置web.config支持jQuery.Uploadify插件上传大文件

    配置web.config有两处地方需要配置,分别是集成模式和经典模式. 集成模式: <!--文件上传大小设置--> <httpRuntime requestValidationMod ...

随机推荐

  1. NYIST 1019 G.亲戚来了

    G.亲戚来了 时间限制:1000 ms  |  内存限制:65535 KB 难度:3   描述 Bob 一家人要去下馆子,为什么呢?因为他姑姑的大爷的叔叔的孙子的表叔的婶婶的儿子来了,亲戚来了当然要下 ...

  2. BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第1章节--SharePoint 2013 介绍 处理开发者需求

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第1章节--SharePoint 2013 介绍 处理开发者需求         SharePoint本质上是一个平台.你 ...

  3. 二维码框架ZBarSDK的使用和自己定义二维码扫描界面方法

    假设你不知道ZBarSDK怎么用,请下载demo http://download.csdn.net/detail/u013686641/7858917 假设你已经配置好ZBarSDK .那么以下这个类 ...

  4. 【翻译自mos文章】开启dblink的 oracle net trace/tracing --对dblink进行跟踪的方法

    开启dblink的 oracle net trace/tracing --对dblink进行跟踪的方法. 參考原文: DBLINK: How to Enable Oracle Net Tracing ...

  5. Error creating bean with name 'testController': Injection of resource dependencies failed;

    启动ssm项目报错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 't ...

  6. Css border样式

    1 四个边框 border-left 设置左边框,一般单独设置左边框样式使用border-right 设置右边框,一般单独设置右边框样式使用border-top 设置上边框,一般单独设置上边框样式使用 ...

  7. Linux 运维笔试题(一)

    试题:   1.说出下列服务对应的端口或者端口对应的服务 21  23  25  873  161  111  110  53  123  2049   2.文件atime,ctime,mtime的区 ...

  8. TP5 安装

    一.官方手册: https://www.kancloud.cn/manual/thinkphp5/118003 二.Git 方式安装[最新框架下载方式] 首先克隆下载应用项目仓库 git clone ...

  9. 学习Go语言之使用channel避免竞态问题

    // 使用channel避免竞态问题 package main import ( "fmt" "sync" ) var ( i int wg sync.Wait ...

  10. JS文字特效:彩色滚动变幻效果,只适合少量的文字。(过多对页面有影响)

    JS代码如下: 代码具体是在哪里的我不知道但是我的有道云上有.如有哪位朋友知道,还望联系下,添加出处. <div id="chakhsu"></div> & ...