zoukankan      html  css  js  c++  java
  • 修改图片上传

    FileDialog.aspx.cs中

           if ((canEdit)&&(browserType != "folder"))
                {
                    string fileSystemToken = Global.FileSystemToken.ToString();
    
                    uploader.UseDropZone = WebConfigSettings.FileDialogEnableDragDrop;
    
                    uploader.UploadButtonClientId = btnUpload.ClientID;
                    uploader.ServiceUrl = navigationRoot
                        + "/Services/FileService.ashx?cmd=uploadfromeditor&q="
                        + Server.UrlEncode(hdnFolder.ClientID)
                        + "&t=" + fileSystemToken;
    
                    //把返回值赋值给 txtSelection控件和hdnFileUrl控件,然后模拟点击btnSubmit按钮
                    //返回值 txtSelction
                    uploader.ReturnValueFormFieldClientId = txtSelection.ClientID;
                    //返回值  hdnFileUrl
                    uploader.ReturnValueFormFieldClientId2 = hdnFileUrl.ClientID;
                    //返回值 btnSubmit
                    uploader.ReturnValueFormFieldClientId3 = btnSubmit.ClientID;

    jqueryFileUpload.cs中

         // set the return value from the upload as the value on the provided input id
                //设置返回值--txtSelection
                if (returnValueFormFieldClientId.Length > 0)
                {
                    script.Append("var input = $('#" + returnValueFormFieldClientId + "'); ");
                    script.Append("if(input){");
    
                    script.Append("if (data.result && $.isArray(data.result.files)) {");
                    script.Append("input.val(data.result.files[0].FileUrl); ");
                    script.Append("} "); //isarray
                    script.Append("} ");
                }
    
                //add by wenjie
                //设置返回值--hdnFileUrl
                if (returnValueFormFieldClientId2.Length > 0)
                {
                    script.Append("var input2 = $('#" + returnValueFormFieldClientId2 + "'); ");
                    script.Append("if(input2){");
    
                    script.Append("if (data.result && $.isArray(data.result.files)) {");
                    script.Append("input2.val(data.result.files[0].FileUrl); ");
                    script.Append("} "); //isarray
                    script.Append("} ");
                }
                //设置返回值  直接点击btnSubmit按钮
                if (returnValueFormFieldClientId3.Length > 0)
                {
                    script.Append("var input3 = $('#" + returnValueFormFieldClientId3 + "'); ");
                    script.Append("if(input3){");               
                    script.Append("input3.click(); ");
            
                    script.Append("} ");
                }
       //返回值2016
            private string returnValueFormFieldClientId = string.Empty;
            /// <summary>
            /// if provided then the returnvalue from the service will be populated in this form element
            /// typical use would be a hidden field
            /// </summary>
            [Themeable(false)]
            public string ReturnValueFormFieldClientId
            {
                get { return returnValueFormFieldClientId; }
                set { returnValueFormFieldClientId = value; }
            }
    
            //返回值2016
            private string returnValueFormFieldClientId2 = string.Empty;
            /// <summary>
            /// if provided then the returnvalue from the service will be populated in this form element
            /// typical use would be a hidden field
            /// </summary>
            [Themeable(false)]
            public string ReturnValueFormFieldClientId2
            {
                get { return returnValueFormFieldClientId2; }
                set { returnValueFormFieldClientId2 = value; }
            }
    
    
    
            //返回值2016
            private string returnValueFormFieldClientId3 = string.Empty;
            /// <summary>
            /// if provided then the returnvalue from the service will be populated in this form element
            /// typical use would be a hidden field
            /// </summary>
            [Themeable(false)]
            public string ReturnValueFormFieldClientId3
            {
                get { return returnValueFormFieldClientId3; }
                set { returnValueFormFieldClientId3 = value; }
            }

     Service/FileService.ashx中

     string newFileName = DateTime.Now.ToString("yyyyMMddmmss") + Path.GetFileName(fileUploaded.FileName).ToCleanFileName(WebConfigSettings.ForceLowerCaseForUploadedFiles);
    

      

  • 相关阅读:
    IOS整体代码复习一
    IOS复习UIActionSheet&UIAlertView
    IOS复习Plist文件的读取和写入
    IOS复习UITextfield&UILabel
    iOS中判断两个圆是否重叠
    iOS指针回调函数
    ios函数指针
    iOS分区
    ios指针第二天
    iOS指针第一天
  • 原文地址:https://www.cnblogs.com/wenjie/p/5452801.html
Copyright © 2011-2022 走看看