Wininet : upload file from POST 
Author Message
 Wininet : upload file from POST

Using wininet i want upload a file on a server with a post form...
in msdn there is:

A The use of file upload with an HTML form is not a very powerful method of
transferring files. If you're writing a full-blown C++ application, you
should take advantage of the rich networking interfaces supported by
Microsoft? Windows?.?.
      If you are writing a client-side application, I recommend that you use
the WinInet functions (see
p). Specifically, you should use the FTP functions, since that's the proper
way to transfer files between machines. You'll find some sample code that
illustrates the use of FTP at
      If you really need to create a C++ application that behaves like an
HTML form, you'll find Knowledge Base article Q165298 useful. It explains
the use of WinInet in an MFC application to simulate form submissions.

I can't use ftp on this server... the only way is to post a form... then as
advice in Q165298 i have read the 8.2 rfc1866 and i'm little bit lost...
i've done this:


 HINTERNET hConnect = InternetConnect(hSession, "",

 HINTERNET hRequest = HttpOpenRequest(hConnect,
"POST","/server/###########~~~.html", NULL, NULL, NULL, 0, 1);
How to construct the request to start the upload ???
 strcpy(request,"how to launch the upload ??");
HttpSendRequest(hRequest, hdrs, strlen(hdrs), request, strlen(request))

A solution is perhaps to uuencode my file (it's an xml file) and pass it in
the form...
but i think there is easier way to do that ??
no ??

thanks for your answers....
Lionel Bthoux

Wed, 30 Jul 2003 01:59:51 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Uploading file with wininet and post form

2. Http Post - Binary file upload

3. A Post Http request using WinINet classes ..

4. post form data w/wininet CHttpFile

5. How to use WinInet send POST request?

6. WinInet and posting

7. Wininet Problems POSTing http / SSL

8. Need Help with WinInet MFC Classes POST method

9. post form data w/wininet CHttpFile

10. How to simulate an HTTP POST with WinInet

11. WinInet POST

12. WinInet: local (file://) files with spaces in the path


Powered by phpBB® Forum Software