Click here to Skip to main content
12,953,223 members (44,877 online)
Rate this:
 
Please Sign up or sign in to vote.
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 11-Dec-12 23:40pm
tygeztt444

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2017
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