2011-10-27 67 views
0

我使用下面的代碼上傳照片至Facebook上傳照片至Facebook返回「預計上傳文件」

hconnect = WinHttpConnect(hsession,L"graph.facebook.com",INTERNET_DEFAULT_HTTPS_PORT,0);`hrequest = WinHttpOpenRequest(hconnect, L"POST", reqUrl,NULL, WINHTTP_NO_REFERER,WINHTTP_DEFAULT_ACCEPT_TYPES,WINHTTP_FLAG_SECURE); 

      CString temp = L"Source:"; 
      temp += objDlg.fileName; 

      bResult = WinHttpAddRequestHeaders(hrequest,temp,(ULONG)-1L,WINHTTP_ADDREQ_FLAG_ADD); 

      CString contentType(L"Content-Type:multipart/form-data"); 

      bResult = WinHttpAddRequestHeaders(hrequest,contentType,(ULONG)-1L,WINHTTP_ADDREQ_FLAG_ADD);bResult = WinHttpSendRequest(hrequest,WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0,objDlg.fileLength, NULL); 
       if(bResult) 
       { 
        DWORD dwBytesWritten = 0; 
        bResult = WinHttpWriteData(hrequest,objDlg.memblock, objDlg.fileLength,&dwBytesWritten);}` 

但其返回「預計上傳爲效應初探。

誰能幫我。

預先感謝

回答

0

Faceebook預計後數據在「多部分/格式數據」的格式。相應形式的數據,並與沿Winh發送數據ttpsendrequest。照片上傳並返回相應的ID。