Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to HTTP post a files and key-value pairs?

how to HTTP post a files and key-value pairs?

Scheduled Pinned Locked Moved C#
csharptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amjath Rahman
    wrote on last edited by
    #1

    Hi! I am a bit lost. I want to upload a files and key-value pairs via HTTP post. A single file and a single collection of key-value pairs is easy. You just have to use the System.Net.WebClient class and its UploadFile, UploadValues method. Can anyone explain to me how to post both files and values with one request? I would very much appreciate any hint! with Regards Amjath

    R 1 Reply Last reply
    0
    • A Amjath Rahman

      Hi! I am a bit lost. I want to upload a files and key-value pairs via HTTP post. A single file and a single collection of key-value pairs is easy. You just have to use the System.Net.WebClient class and its UploadFile, UploadValues method. Can anyone explain to me how to post both files and values with one request? I would very much appreciate any hint! with Regards Amjath

      R Offline
      R Offline
      Rob Philpott
      wrote on last edited by
      #2

      Well, I guess it depends on what the server is expecting. Is it expecting files and name value pairs in a single request? Another way of posting data to the web is to use the HttpWebRequest Class. This has a property which I think is called 'verb' which you want to set to POST. You can then send as much data as you like using this. It's stream based. Is that the sort of thing you're after?

      Regards, Rob Philpott.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups