In FileDialog.aspx.cs
if((CanEdit) && (BrowserType! ="folder")) { stringFilesystemtoken =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; //assign the return value to the Txtselection control and the Hdnfileurl control, and then simulate the Click btnsubmit button//return value TxtselctionUploader. Returnvalueformfieldclientid =Txtselection.clientid; //return value HdnfileurlUploader. RETURNVALUEFORMFIELDCLIENTID2 =Hdnfileurl.clientid; //return value BtnsubmitUploader. RETURNVALUEFORMFIELDCLIENTID3 = Btnsubmit.clientid;
In JqueryFileUpload.cs
//Set the return value from the upload as the value on the provided input ID//set the return value--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 ("} ");//IsArrayScript. Append ("} "); } //Add by Wenjie//set the return value--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 ("} ");//IsArrayScript. Append ("} "); } //set the return value directly by clicking the Btnsubmit button if(Returnvalueformfieldclientid3.length >0) {script. Append ("var input3 = $ (' #"+ ReturnValueFormFieldClientId3 +"'); "); Script. Append ("if (input3) {"); Script. Append ("Input3.click ();"); Script. Append ("} "); }
//return value Private stringReturnvalueformfieldclientid =string. Empty; /// <summary> ///if provided then the returnvalue from the service would be is populated in this form element///Typical use would be a hidden field/// </summary>[Themeable (false)] Public stringReturnvalueformfieldclientid {Get{returnReturnvalueformfieldclientid;} Set{Returnvalueformfieldclientid =value;} } //return value Private stringRETURNVALUEFORMFIELDCLIENTID2 =string. Empty; /// <summary> ///if provided then the returnvalue from the service would be is populated in this form element///Typical use would be a hidden field/// </summary>[Themeable (false)] Public stringRETURNVALUEFORMFIELDCLIENTID2 {Get{returnReturnValueFormFieldClientId2;} Set{returnValueFormFieldClientId2 =value;} } //return value Private stringRETURNVALUEFORMFIELDCLIENTID3 =string. Empty; /// <summary> ///if provided then the returnvalue from the service would be is populated in this form element///Typical use would be a hidden field/// </summary>[Themeable (false)] Public stringRETURNVALUEFORMFIELDCLIENTID3 {Get{returnReturnValueFormFieldClientId3;} Set{returnValueFormFieldClientId3 =value;} }
In Service/fileservice.ashx
String newfilename = DateTime.Now.ToString ("Yyyymmddmmss") + path.getfilename (fileuploaded.filename). Tocleanfilename (Webconfigsettings.forcelowercaseforuploadedfiles);
Edit Image Upload