Partial Class admin_upload
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim UpPath As String
Dim UpName As String
UpPath = "/images"
UpName = Dir(UpPath, vbDirectory)
If (UpName = "") Then
MkDir("/images")
End If
End Sub
Protected Sub uplodto_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uplodto.Click
FileName.InnerHtml = FileFiled.PostedFile.FileName
FileContent.InnerHtml = FileFiled.PostedFile.ContentType
FileSize.InnerHtml = FileFiled.PostedFile.ContentLength
UploadDetails.Visible = True
Dim myfilename As String
myfilename = FileFiled.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(myfilename)
Try
FileFiled.PostedFile.SaveAs("images\" + c)
Span1.InnerHtml = "File uploaded successfuly"
Catch ex As Exception
Span1.InnerHtml = "faild"
UploadDetails.Visible = False
End Try
End Sub
End Class
我想在网站文件夹和服务器上确定文件的方向