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. Web Development
  3. Receiving posted file

Receiving posted file

Scheduled Pinned Locked Moved Web Development
helpcsharpcomgame-devsysadmin
2 Posts 1 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.
  • B Offline
    B Offline
    Brent Lamborn
    wrote on last edited by
    #1

    I'm using System.Net.WebClient to upload files to my server. The client is a windows application, not a web app. I've attempted to POST to my aspx page using two methods in the WebClient class. The first UploadFileAsync works well, unless I POST a file larger than 4 mb. Here is the code in the aspx page to receive the posted file: foreach (string f in Request.Files.AllKeys) { HttpPostedFile file = Request.Files[f]; file.SaveAs("c:\\inetpub\\test\\UploadedFiles\\" + file.FileName); } So I thought I would try using UploadDataAsynch instead to see if there is a similar issue with the size of the POST. My problem is that I don't know exactly how to receive the data in the POST on the web page and write it to file on the server when using UploadDataAsynch. I'm sure it is very simple code but it's eluding me at the moment. If any one has a suggestion, I'd appreciate it.


    "Half this game is ninety percent mental." - Yogi Berra If you can read thank a teacher, if you can read in English, thank a Marine.

    B 1 Reply Last reply
    0
    • B Brent Lamborn

      I'm using System.Net.WebClient to upload files to my server. The client is a windows application, not a web app. I've attempted to POST to my aspx page using two methods in the WebClient class. The first UploadFileAsync works well, unless I POST a file larger than 4 mb. Here is the code in the aspx page to receive the posted file: foreach (string f in Request.Files.AllKeys) { HttpPostedFile file = Request.Files[f]; file.SaveAs("c:\\inetpub\\test\\UploadedFiles\\" + file.FileName); } So I thought I would try using UploadDataAsynch instead to see if there is a similar issue with the size of the POST. My problem is that I don't know exactly how to receive the data in the POST on the web page and write it to file on the server when using UploadDataAsynch. I'm sure it is very simple code but it's eluding me at the moment. If any one has a suggestion, I'd appreciate it.


      "Half this game is ninety percent mental." - Yogi Berra If you can read thank a teacher, if you can read in English, thank a Marine.

      B Offline
      B Offline
      Brent Lamborn
      wrote on last edited by
      #2

      Ah problem solved. I can upload larger files with UploadFileAsych, I simply needed to override the default setting of 4mb in the system.web section of my web.config by setting this: <httpRuntime maxRequestLength="10240" > Here is the kb if anyone is interested.: http://support.microsoft.com/kb/295626[^]


      "Half this game is ninety percent mental." - Yogi Berra If you can read thank a teacher, if you can read in English, thank a Marine.

      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