Protected Sub SaveFile(ByVal file As HttpPostedFile) Dim SavePath As String = Server.MapPath("../UploadFile/") Dim FileName As String = File1.FileName Dim TempFile As String Dim PathToCheck As String = SavePath + FileName If (System.IO.File.Exists(PathToCheck)) Then Dim Counter As Integer = 2 While System.IO.File.Exists(PathToCheck) TempFile = Counter.ToString() + FileName PathToCheck = SavePath + TempFile Counter = Counter + 1 End While FileName = TempFile UploadStatusLabl.Text = "A Document With The Same Name Exist." + "<br/>" + _ "Your Document Was Saved As" + FileName Else UploadStatusLabl.Text = "Your Document Was Attached Sucessfully." End If SavePath += FileName File1.SaveAs(SavePath) With acca .LetterAttachmentPath = SavePath .FileName = FileName End With End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)