---------- 20190611 ref: https://docs.microsoft.com/zh-tw/dotnet/api/system.web.ui.webcontrols.fileupload.saveas?view=netframework-4.8#System_Web_UI_WebControls_FileUpload_SaveAs_System_String_ 下列範例示範如何建立FileUpload執行錯誤檢查的控制項。 在儲存檔案之前,HasFile呼叫方法來驗證要上傳的檔案是否存在。 颾魤 ㄛFile.Exists呼叫方法來檢查是否已有相同名稱的檔案是否存在於路徑中。 若是如此,要上傳的檔案名稱前面會加上前面的數字SaveAs呼叫方法。 這可防止遭到覆寫現有的檔案。 <%@ Page Language="C#" %> FileUpload.SaveAs Method Example

FileUpload.SaveAs Method Example

Select a file to upload: