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
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 hSession = InternetOpen("MyAgent", INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0);
HINTERNET hConnect = InternetConnect(hSession, "www.myserver.space.com",
INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
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
but i think there is easier way to do that ??
thanks for your answers....