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);
    
              });
    
    }
  • 相关阅读:
    二进制运算
    python魔法函数__dict__和__getattr__的妙用
    logging模块配置笔记
    一个python爬虫工具类
    和我一起学爬虫(一)
    不一样的谷歌搜索
    CentOS6.4安装辅助NIS的流程
    ROS6.16开始支持802.11ac了,扫盲下
    centos 安装 Splunk
    扫盲贴2.5寸移动硬盘的厚度有几种
  • 原文地址:https://www.cnblogs.com/gaobing/p/3848280.html
Copyright © 2011-2022 走看看