private global::System.Web.UI.WebControls.FileUpload @__BuildControlfileDocumento() { global::System.Web.UI.WebControls.FileUpload @__ctrl; @__ctrl = new global::System.Web.UI.WebControls.FileUpload(); this.fileDocumento = @__ctrl; @__ctrl.ApplyStyleSheetSkin(this.Page); @__ctrl.ID = "fileDocumento"; return @__ctrl; }
private global::System.Web.UI.WebControls.FileUpload @__BuildControlFileUpload1() { global::System.Web.UI.WebControls.FileUpload @__ctrl; @__ctrl = new global::System.Web.UI.WebControls.FileUpload(); this.FileUpload1 = @__ctrl; @__ctrl.ApplyStyleSheetSkin(this.Page); @__ctrl.ID = "FileUpload1"; return(@__ctrl); }
/// <summary> /// /// </summary> /// <param name="file"></param> /// <param name="savePath"></param> /// <param name="extension"></param> /// <param name="message"></param> /// <returns></returns> public static bool UploadFile(global::System.Web.UI.WebControls.FileUpload file, string savePath, string extension, out string message) { bool isSuccess = false; string filepath = string.Empty; string fileName = file.PostedFile.FileName; message = string.Empty; string saveName = DateTime.Now.ToString("yyyyMMddHHmmss") + RNG.Next(10000, 99999); string exten = Path.GetExtension(fileName).ToLower(); if (!Directory.Exists(savePath + "images/Package/")) { Directory.CreateDirectory(savePath + "images/Package/"); } filepath = "images/package/" + saveName + exten; if (!String.IsNullOrEmpty(extension)) { extension = extension.ToLower(); if (extension.IndexOf(exten) < 0) { message = "只允许上传格式为:" + extension + "的文件"; return(isSuccess); } } try { file.SaveAs(savePath + filepath); message = filepath; isSuccess = true; } catch (Exception ex) { message = ex.Message; } return(isSuccess); }
private global::System.Web.UI.WebControls.FileUpload @__BuildControlFileUpload1() { global::System.Web.UI.WebControls.FileUpload @__ctrl; @__ctrl = new global::System.Web.UI.WebControls.FileUpload(); this.FileUpload1 = @__ctrl; @__ctrl.ApplyStyleSheetSkin(this.Page); @__ctrl.ID = "FileUpload1"; return @__ctrl; }
private global::System.Web.UI.WebControls.FileUpload @__BuildControlfileUploadControl() { global::System.Web.UI.WebControls.FileUpload @__ctrl; @__ctrl = new global::System.Web.UI.WebControls.FileUpload(); this.fileUploadControl = @__ctrl; @__ctrl.ApplyStyleSheetSkin(this.Page); @__ctrl.ID = "fileUploadControl"; @__ctrl.AllowMultiple = true; return @__ctrl; }