Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows Mobile Post HTTP
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
Posted 12-Dec-12 0:40am
tygeztt444

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



Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100