#region 上载文件
/// <summary>
/// 上载文件.
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public bool UploadFile(FileUpload fileU, out string filePath)
{
bool bReturn = false;
string uploadFileName = string.Empty; FileInfo info;
info = new FileInfo(fileU.PostedFile.FileName);
string strExten = info.Extension;
Guid storageName = Guid.NewGuid();
uploadFileName = info.Name.Trim();//上传后存贮的文件名
try
{
filePath = Const.UpLoadPath + "\\" + storageName + strExten;
fileU.PostedFile.SaveAs(filePath);
bReturn = true;
}
catch
{
throw new Exception("UpLoad Error !");
}
return bReturn;
}
#endregion
/// <summary>
/// 上载文件.
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public bool UploadFile(FileUpload fileU, out string filePath)
{
bool bReturn = false;
string uploadFileName = string.Empty; FileInfo info;
info = new FileInfo(fileU.PostedFile.FileName);
string strExten = info.Extension;
Guid storageName = Guid.NewGuid();
uploadFileName = info.Name.Trim();//上传后存贮的文件名
try
{
filePath = Const.UpLoadPath + "\\" + storageName + strExten;
fileU.PostedFile.SaveAs(filePath);
bReturn = true;
}
catch
{
throw new Exception("UpLoad Error !");
}
return bReturn;
}
#endregion
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货