我正在尝试使用 Path() 但它下面有一条蓝线并说:“在声明之前不能引用局部变量(路径)。” 如何使用路径()?
Imports System.Globalization
Imports System.IO
Public Class MessageController
Inherits System.Web.Mvc.Controller
<EmployeeAuthorize()>
<HttpPost()>
Function SendReply(ByVal id As Integer, ByVal message As String, ByVal files As IEnumerable(Of HttpPostedFileBase)) As JsonResult
' upload files
For Each i In files
If (i.ContentLength > 0) Then
Dim fileName = path.GetFileName(i.FileName)
Dim path = path.Combine(Server.MapPath("~/App_Data/uploads"), fileName)
i.SaveAs(path)
End If
Next
End Function
End Class