zoukankan      html  css  js  c++  java
  • uploadify上传带参数及接收参数的方法

    function uploadify() {
            $("#uploadify").uploadify({
                method:'post',
                uploader: '/Manage/Order/SubmitUploadify',
                swf: '/Content/scripts/plugins/uploadify/uploadify.swf',
                buttonText: "上传文件",
                height: 30,
                 110,
                fileTypeExts: '*.jpg;*.doc;*.docx;*.pdf;*.png',
                fileSizeLimit: '10MB',
                multi: false,
                formData: "ContractCode":"20170222","UserId":"20125"
                },
                onUploadStart: function (file) {
                    some code...
                },
                onUploadSuccess: function (file, data, response) {
                    var obj = jQuery.parseJSON(data); 
                    if (obj.State) {
                        $("#ContractFile").val(obj.FilePath);
                    }
                },
                onUploadError: function (file) {
                    $("#" + file.id).prepend('<span class="error" title="失败"><i class="fa fa-exclamation-circle"></i></span>');
                }
            });
            $("#uploadify-button").prepend('<i style="opacity: 0.6;" class="fa fa-cloud-upload"></i>&nbsp;');
        }

    参数主要在:formData: "ContractCode":"20170222","UserId":"20125" 位置

    接收参数方法:

    [HttpPost]
    public ActionResult SubmitUploadify(HttpPostedFileBase fileData,string contractCode,string userId)
    {
       string formatFilePath = string.Format("~/Uploads/ContractFile/{0}", contractCode);
       ResultUpload rst = UploadHelper.Uploadify(fileData, formatFilePath);
       return Content(rst.ToJson());
    }
  • 相关阅读:
    poj 2312 Battle City
    poj 2002 Squares
    poj 3641 Pseudoprime numbers
    poj 3580 SuperMemo
    poj 3281 Dining
    poj 3259 Wormholes
    poj 3080 Blue Jeans
    poj 3070 Fibonacci
    poj 2887 Big String
    poj 2631 Roads in the North
  • 原文地址:https://www.cnblogs.com/firstcsharp/p/6430094.html
Copyright © 2011-2022 走看看