Uploading files using VB.NET

Discussion in 'Visual Studio' started by rayan05, Aug 31, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi...


    I want to upload files using vb.net windows form. I tried to use following codes



    Dim wb As System.Net.WebClient = New System.Net.WebClient


    Dim responce As Byte() = wb.UploadFile("Http://mysite.com/", "c:\somefile.txt")


    But this simply not working. Not generate any error message. think I have to add the passowrd someware.


    Can anyone help me ? If you know anyother uploading method it also will helpfull


    Thanks
     
  2. try changing this...

    Dim responce As Byte() = wb.UploadFile("Http://mysite.com/", "c:\somefile.txt")

    to this...

    Dim responce As Byte() = wb.UploadFile(Http://mysite.com/, "POST","c:\somefile.txt")


    You probably won't receive an error, unless there's a protocol error. You'll have to check the response to see how the web server responds.

    Also, you probably wont be able to upload to http://mysite.com/. The webserver will not auto-post to the default document, so if you are trying to post to default.aspx, you'll need to specify it like this http://mysite.com/default.aspx.






    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page