zoukankan      html  css  js  c++  java
  • jquery uploadify 使用

    /*进度条框*/
    .shangchuantishikuang {
        border: 7px solid #74A5BF;
        background-color: white;
        font-size: 14px;
        color: #666666;
        font-family: 'Microsoft YaHei';
        position: fixed;
        top: 170px;
        left: 700px;
        width: 400px;
        padding: 10px;
        padding-left: 0px;
        padding-top: 0px;
        z-index: 10000;
    }
          #region 图片上传
    
            [AcceptVerbs(HttpVerbs.Post)]
            public JsonResult Upload(HttpPostedFileBase fileData)
            {
    
                if (fileData != null)
                {
                    try
                    {
                        //1.拼接图片路径
                        var fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fileData.FileName);
                        //2.上传到阿里云
                       //3.返回结果
                        return Json(new { Success = true, FileName=fileName }, JsonRequestBehavior.AllowGet);
                    }
                    catch (Exception ex)
                    {
                        return Json(new { Success = false, Message ="error"}, JsonRequestBehavior.AllowGet);
                    }
                }
                else
                {
                    return Json(new { Success = false, Message = "fail" }, JsonRequestBehavior.AllowGet);
                }
            }
            #endregion     
    
    
    
    //上传图片
    function inital(id, text, s) {
    
        //进度框
        $("#fileQueue").hide();
        $('#' + id).uploadify({
            'buttonText': text,
            'queueID': 'fileQueue',
            'fileTypeDesc': '请选择图片',
            //允许上传的文件后缀
            'fileTypeExts': '*.gif; *.jpg; *.png',
            'swf': '/Scripts/uploadify-v3.1/uploadify.swf?rom=' + Math.random(),
            'uploader': '/Controller/Upload?rom=' + Math.random(),
            'onUploadSuccess': function (file, data, response) { //文件上传成功时处理
                eval("data=" + data);
    
              });
    
    }
  • 相关阅读:
    Java内部类
    sql几种连接的区别
    常见的十大算法
    使用yml文件配置数据库数据时的问题
    SpringBoot整合Mybatis
    不是书评 :《我是一只IT小小鸟》
    考试考完了·
    MSSQL站库分离情况的渗透思路
    VENOM cve-2015-3456 Qemu 虚拟机逃逸漏洞POC
    Python 实现指定目录下 删除指定大小的文件
  • 原文地址:https://www.cnblogs.com/gaobing/p/3848280.html
Copyright © 2011-2022 走看看