0
我需要在每次上傳文件時在文件末尾添加增量編號。我去做它幾乎工作。爲上傳文件添加增量編號
請檢查下面的代碼:
Dim intVersion As Integer = 1
While (System.IO.File.Exists(strDestinationPath))
Dim temp As Integer = ourFilename.LastIndexOf(".")
Dim temp2 As String = ourFilename.Substring(temp)
ourFilename = ourFilename.Replace(temp2, "_" & intVersion & temp2)
strDestinationPath = System.Configuration.ConfigurationManager.AppSettings("WebLocalContentDir") & "\VisualID\" & ourFilename
intVersion += 1
End While
如果我上傳的文件3倍,其另存爲,
第1次:VDFGH 第2次:VDFGH_1 第3次:VDFGH_1_2(預期輸出是VDFGH_2)
感謝它的工作... – Joshua