Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Now,I want to post a zip file to the web,the key code on the below:
C++
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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900