上传

 

 

/// <summary>
/// 上传文件 返回保存后的新 文件名(徐超)
/// </summary>
/// <param name="fileUpload">页面fileupload控件</param>
/// <param name="folderName">想保存在文件夹的名称</param>
/// <returns></returns>
public static string UploadFile(FineUI.FileUpload fileUpload, string folderName)
{
string result = "";
string serverpath =HttpContext.Current.Server.MapPath("~/Files/");

if (!File.Exists(serverpath + fileUpload.ShortFileName))
{
string date = DateTime.Now.ToString("yyyyMMddhhmmss");
fileUpload.SaveAs(serverpath + date + fileUpload.ShortFileName);
//返回到 xxx.xls
result = date + fileUpload.ShortFileName;
}
return result;
}

posted on 2017-11-01 13:28  4job  阅读(98)  评论(0编辑  收藏  举报

导航