The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Uploading Files Using HTTP POST

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Doug Thews

Posts: 866
Nickname: dougthews
Registered: Jul, 2003

Doug Thews is a software developer/manager for D&D Consulting Services with 18+ years of experience
Uploading Files Using HTTP POST Posted: Dec 30, 2003 10:35 PM
Reply to this message Reply

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
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Doug Thews
Latest Posts From IlluminatiLand

Advertisement

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:

httpResponseArray = _
myWebClient.UploadFile("http://servername.com/dir/", "POST", "LocalFileName")

You'll need to use the fully qualified directory and filename for UploadFile() to work:

httpResponseArray = _
myWebClient.UploadFile("http://servername.com/dir/default.aspx", "POST", "LocalFileName")

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).

Read: Uploading Files Using HTTP POST

Topic: Final Release of NAnt 0.84 Released Previous Topic   Next Topic Topic: A plug for

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use