This post originated from an RSS feed registered with .NET Buzz
by Doug Thews.
Original Post: Uploading Files Using HTTP POST
Feed Title: IlluminatiLand
Feed URL: http://apps5.oingo.com/apps/domainpark/domainpark.cgi?client=netw8744&s=JETBRAINS.COM
Feed Description: A technology blog for people enlightened enough to think for themselves
I was goofing around with some of the examples I've seen floating around the Internet on various ways to upload files to a remote web server using the HTTP POST method. The reason being that I've seen a lot of questions on the ASP.NET board lately about not being able to get it to work correctly. So, I thought I'd add my 2 cents worth in the documentation ring to (hopefully) provide some additional documentation.
#1. Although it doesn't state it verbatim, to use HTTP POST you have to have a receptor running on the remote web server. This can be a web server, ASPX file, or whatever. Just something to accept an HTTP POST. Just sending an HTTP POST to a web directory will not automatically upload a file for you (a common misconception).
#2. If you're going to use the WebClient.UploadFile, then remember to include the fully qualified directory and filename. Even if you intend on using default.aspx as your receptor's name, the following won't work:
Hope this helps those who are looking for help uploading files with HTTP in VB.NET (or any other managed language - VB.NET just happens to be my preference lately).