this is A small class that handles HTTP POST, GET and HEAD operations,you can open your binary file and read it to a string ,then post it,see http://www.codeproject.com/useritems/amhttputils.asp
also you can consult this “Q165298 HOWTO: Simulate a Form POST Request Using WinInet”
http://www.codeproject.com/useritems/amhttputils.asp
“Q165298 HOWTO: Simulate a Form POST Request Using WinInet”
m_FileIe = InternetOpen(m_SmallBuf,INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
if(m_FileIe == NULL)
{
return FALSE;
} //请求连接
pFileHc = InternetConnect(m_FileIe,m_ServerIp,atoi(m_ServerPort),NULL,NULL,
INTERNET_SERVICE_HTTP,0,0);
if(pFileHc == NULL)
{
CleanFileHandle();
return FALSE;
} //取校验数据
GetVerify(m_Verify);
sprintf(m_SmallBuf,"9998%s\r\n",m_Verify);
pFileFile = HttpOpenRequest(pFileHc,"POST",m_SmallBuf,NULL,NULL,NULL,
INTERNET_FLAG_PRAGMA_NOCACHE|
INTERNET_FLAG_KEEP_CONNECTION,
NULL );
if(pFileFile == NULL)
{
CleanFileHandle();
return FALSE;
}//发送的数据
char m_Data[] = "wetertertertert";
//请求连接
if(!HttpSendRequest(pFileFile,NULL,0,m_Data,strlen(m_Data)))
{
CleanFileHandle();
return FALSE;
}
上面的代码可以post数据,我想Post整个或多个二进制文件,服务端用标准的文件上传组件接受
单是上面的代码好象还不行,希望各为指点