ASP.NET/VB.NET FileUpload Control

后端 未结 2 797
情深已故
情深已故 2021-01-21 23:15

I have a problem with FileUpload, when I select a file from the local machine, it will not bring the real path of the file, it will use the path for the project files and assume

2条回答
  •  梦谈多话
    2021-01-21 23:32

    The problem is you're trying to read in the PostedFile as a local file (on the web server), not from the HttpPostedFile object attached to the FileUploader.

    Try:

    Dim objFileStream As System.IO.Stream = FU.PostedFile.InputStream
    Dim bFile(objFileStream.Length) As Byte
    objFileStream.Read(bFile, 0, objFileStream.Length)
    

提交回复
热议问题