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);
    
              });
    
    }
  • 相关阅读:
    linux服务篇
    降智比赛题解
    CF 1437 题解
    ZR 2020普转提七连测day5
    20联赛集训day11 题解
    contest5 题解
    20联赛集训day9 题解
    20联赛集训day8 题解
    contest4 题解
    20联赛集训day7 题解
  • 原文地址:https://www.cnblogs.com/gaobing/p/3848280.html
Copyright © 2011-2022 走看看