当我试图上传文件时,它显示路径不是虚拟的,它显示“E:/”+ dest路径所以任何人都可以建议如何上传我的文件在下面的路径是VB代码
Protected Sub Upload_Files(sender As Object, e As EventArgs)
' CHECK IF ANY FILE HAS BEEN SELECTED.
If fileUpload.HasFile Then
Dim iUploadedCnt As Integer = 0
Dim iFailedCnt As Integer = 0
Dim hfc As HttpFileCollection = Request.Files
lblFileList.Text = "Select <b>" & hfc.Count & "</b> file(s)"
If hfc.Count <= 10 Then ' 10 FILES RESTRICTION.
For i As Integer = 0 To hfc.Count - 1
Dim hpf As HttpPostedFile = hfc(i)
If hpf.ContentLength > 0 Then
If Not File.Exists(Server.MapPath("\\Destinationpath\testing") & _
Path.GetFileName(hpf.FileName)) Then
Dim objDir As New DirectoryInfo(Server.MapPath("\\Destinationpath\testing"))
Dim objFI As FileInfo() = _
objDir.GetFiles(Replace(Path.GetFileName(hpf.FileName), _
Path.GetExtension(hpf.FileName), "") & ".*")
If objFI.Length > 0 Then
' CHECK IF FILE WITH SAME NAME EXISTS (IGNORING THE EXTENTIONS).
For Each file As FileInfo In objFI
If Replace(objFI(0).Name, Path.GetExtension(objFI(0).Name), "") = _
Replace(Path.GetFileName(hpf.FileName),
Path.GetExtension(hpf.FileName), "") Then
iFailedCnt = iFailedCnt + 1
Exit For
End If
Next
Else
' SAVE THE FILE IN A FOLDER.
hpf.SaveAs(Server.MapPath("\\Destinationpath\testing") & _
Path.GetFileName(hpf.FileName))
iUploadedCnt = iUploadedCnt + 1
End If
End If
End If
Next i
lblUploadStatus.Text = "<b>" & iUploadedCnt & "</b> file(s) Uploaded."
lblFailedStatus.Text = "<b>" & iFailedCnt & _
"</b> duplicate file(s) could not be uploaded."
Else
lblUploadStatus.Text = "Max. 10 files allowed."
End If
Else
lblUploadStatus.Text = "No files selected."
End If
End Sub
以下是执行此代码时的错误 找不到路径'E:\ Destinationpath \ testing'的一部分。