本文整理匯總了C#中System.Web.UI.WebControls.FileUpload.Equals方法的典型用法代碼示例。如果您正苦於以下問題:C# FileUpload.Equals方法的具體用法?C# FileUpload.Equals怎麽用?C# FileUpload.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.UI.WebControls.FileUpload
的用法示例。
在下文中一共展示了FileUpload.Equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DefaultNameSave
//Parameter : Web FileUpload Control
public string DefaultNameSave(FileUpload fileUpload)
{
string result = null;
if (fileUpload.Equals(null)) return result;
string filename = fileUpload.FileName;
if (filename.Equals("")) return result;
if (!(new Validate(filename, uploadType).Checked())) return result;
string fileExtension = System.IO.Path.GetExtension(filename);
result = newName + "_" + System.IO.Path.GetFileNameWithoutExtension(filename) + fileExtension;
fileUpload.SaveAs(savePath + result);
return result;
}
示例2: DefaultNameUpdate
public string DefaultNameUpdate(string oldFileName, FileUpload fileUpload)
{
string result = null;
if (fileUpload.Equals(null)) return result;
string filename = fileUpload.FileName;
if (filename.Equals("")) return result;
if (!(new Validate(filename, uploadType).Checked())) return result;
string fileExtension = System.IO.Path.GetExtension(filename);
if (newName != null && newName.Trim().Length > 0 && System.IO.File.Exists(savePath + oldFileName))
{
result = newName + "_" + System.IO.Path.GetFileNameWithoutExtension(filename) + fileExtension;
System.IO.File.Delete(savePath + oldFileName);
fileUpload.SaveAs(savePath + result);
}
return result;
}