Now,I want to post a zip file to the web,the key code on the below:
CHttpConnection * pHC = NULL;
CHttpFile * pHF = NULL;
CInternetSession cis;
CString strBoundry = _T("-----------------------------7d86d16250370");
pHF = pHC->OpenRequest(CHttpConnection::HTTP_VERB_POST, strObject);
CString strHeader = MakeRequestHeaders(strBoundry,strFileName,strServer,wPort);
CString strHeader1 = MakePreFileData(strBoundry,strFileName);
pHF->AddRequestHeaders(strHeader);
if(!pHF->SendRequest(strHeader,0, pFileBuff, dwFileLength)) {
delete[]pFileBuff;
pFileBuff = NULL;
pHF->Close();
pHC->Close();
cis.Close();
MessageBox(NULL,_T("upload failed!"),_T("Title"),MB_ICONEXCLAMATION|MB_OK);
return FALSE;
DWORD dwStateCode = 0;
pHF->QueryInfoStatusCode(dwStateCode);
if(dwStateCode == HTTP_STATUS_OK)
{
bResult = TRUE;
MessageBox(NULL,_T("upload successed!"),_T ("Title"),MB_ICONEXCLAMATION|MB_OK);
}
}
Content-Type: multipart/form-data;
after excuted my code,the tomact notice me the asking rest service successful,but have no data.How can I upload a zip file to web?thanks