会有什么问题呢?无非就是指定的server.mappath() 中的路径改一下.根目录下 u1 文件夹 u1.aspx Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If FileUpload1.HasFile Then FileUpload1.PostedFile.SaveAs(Server.MapPath("../upload/") & Now.ToString("yyyyMMddhhmmss") & System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)) End If End Sub根目录下 u2 文件夹 u2.aspx Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If FileUpload1.HasFile Then FileUpload1.PostedFile.SaveAs(Server.MapPath("../upload/") & Now.ToString("yyyyMMddhhmmss") & System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)) End If End Sub根目录下 u3.aspx Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If FileUpload1.HasFile Then FileUpload1.PostedFile.SaveAs(Server.MapPath("upload/") & Now.ToString("yyyyMMddhhmmss") & System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)) End If End Sub
你的这些页面是不是都不在同一个路径的?
改改Server.MapPath的参数就可以了啊看看MSDN上面对Server.MapPath的解释,就几句而已
你指定一下它的相对路径
If FileUpload1.HasFile Then
FileUpload1.PostedFile.SaveAs(Server.MapPath("../upload/") & Now.ToString("yyyyMMddhhmmss") & System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName))
End If
End Sub根目录下 u2 文件夹 u2.aspx Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If FileUpload1.HasFile Then
FileUpload1.PostedFile.SaveAs(Server.MapPath("../upload/") & Now.ToString("yyyyMMddhhmmss") & System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName))
End If
End Sub根目录下 u3.aspx Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If FileUpload1.HasFile Then
FileUpload1.PostedFile.SaveAs(Server.MapPath("upload/") & Now.ToString("yyyyMMddhhmmss") & System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName))
End If
End Sub