Solved

Using POST to send a file to a web server...

Posted on 2004-04-29
6
197 Views
Last Modified: 2010-04-24
Hi,

Part of a program I'm writing needs to send a file to a remote server. Rather than using FTP, I think it would be an advantage to 'post' it to a page on the server (as I could also send additonal fields of data).

I can easily write a asp.net page at the server end that will accept a file that has been posted (it works with a form and a 'file' field), but what i need to do is write the code in vb.net that posts the file.

Ive found code that will post a form (using HttpRequest and HttpResponse), however I cant find out how to add a file to the datastream.

Any help would be great!

Many thanks,

Tim Alston

0
Comment
Question by:Backflipping
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11123149
You can use a StreamReader to get a file into a stream that you can feed to the Response stream, but I am not sure how that will be handled.  This technique can be used to process an image, and then have it rendered at the browser.

Bob
0
 

Author Comment

by:Backflipping
ID: 11123412
Hi Bob,

Yes, I think that a Stream will be the way to do this - and I have used the StreamWriter and Response stream for images (sizing, compressing and then passing directly to the browser). It's the posting part however that I'm unsure how to do??? (And it seems maybe nobody does, as this topic has been here a while now!).

Thanks,

Tim
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11125761
I am not exactly sure if I do either, but since I am the Cleanup volunteer for this Topic Area, I come across these questions all the time.

E-E is the perfect opportunity for me to teach and learn.  It gives me the chance to work outside of the box.  Also, I have a few contacts that might be able to find the answer to your question.  Along the way, I get to learn about something that I find very interesting.

Given the chance, I think that I can always find a solution, but I guess that comes from the eternal optimist in me.

Bob
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 465 total points
ID: 11142339
Would the HTTPResponse.WriteFile method do what you want?

Bob
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question