upload image using the WebRequest


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: upload image using the WebRequest

Threaded View

  1. #1
    Join Date
    Mar 2008
    Posts
    164

    upload image using the WebRequest

    hi,
    i need to upload a image to a site by using
    the WebRequest so far i have this for send values:
    Code:
     Dim request As WebRequest = WebRequest.Create(site_name)
    request.Method = "POST"
    
     Dim byteArray As Byte() = Encoding.ASCII.GetBytes(post_value)
     request.ContentType = "application/x-www-form-urlencoded"
                request.ContentLength = byteArray.Length
                Dim dataStream As Stream = request.GetRequestStream()
                dataStream.Write(byteArray, 0, byteArray.Length)
                dataStream.Close()
                Dim response As WebResponse = request.GetResponse()
                dataStream = response.GetResponseStream()
                Dim reader As New StreamReader(dataStream)
    
                Dim responseFromServer As String = reader.ReadToEnd()
    
                reader.Close()
                dataStream.Close()
                response.Close()
    
     MsgBox(responseFromServer)
    but for send a image i have no ideia how do, i have looking for samples but
    i only find for c# and i need this for vb.net

    what i need change in my code to upload images to?
    and other question how can i send cookies to the page?
    thanks a lot for your help
    Last edited by Hack; 02-27-2009 at 08:35 AM. Reason: Added Code Tags

Similar Threads

  1. ASP- Image upload to access database
    By sandhya.o.k in forum ASP.NET
    Replies: 1
    Last Post: 02-22-2007, 06:29 AM
  2. Replies: 0
    Last Post: 10-05-2006, 12:33 AM
  3. Upload Image
    By hazaraSp in forum .NET
    Replies: 0
    Last Post: 05-09-2006, 03:26 AM
  4. upload an image file and save on webserver.
    By sandhyaharsh in forum Java
    Replies: 0
    Last Post: 11-15-2005, 06:23 AM
  5. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center