Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

How to send file over internet using http headers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raichu - 22 Feb 2005 21:47 GMT
Hi All,

I'm new to VC++.net and I searched through the forums and couldn't
find anything related to this.

I'm trying to send a flat file from a VC++.net program to a PHP file
residing on a webserver.   I know you can call a website from
VC++.net, but I'm not sure how to send a physical file over the
internet.  I mean is there a way to mimic a normal html form to
upload a file, using VC++.net?

Any information or links would be appreciated.

Thanks.
Carl Daniel [VC++ MVP] - 23 Feb 2005 02:08 GMT
> Hi All,
>
[quoted text clipped - 8 lines]
>
> Any information or links would be appreciated.

You can make an HTTP POST using any number of technologies including:

0. Winsock
1. WinInet (wrapper over Winsock)
2. WinHttp
3. MFC (wrapper over WinInet)

To send a file you need to simulate a form-url-encoded posting with an
appropriate MIME type.  Basically, you need to build of a string that
contains the necessary headers and content to simulate a form post, and then
send it using one of the technologies above.

You can learn all the details of the form encoding by looking at the
apprproaite RFCs at www.ietf.org.  Some RFC numbers that would be of
interest include:

2045, 2046, 2047, 2048, 2049, 2854

another technique is to use a network monitor ("packet sniffer") to capture
the data sent by a standard web browser (such as IE) when executing the
actual form post.  You then simply substitute your file data into the post
at the appropriate place (and set the content length correctly, of course).

-cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.