You're viewing a comment by jack and its responses.
You're viewing a comment by jack and its responses.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
I love to read science books. They make my day and I get ideas for awesome blog posts, such as Busy Beaver, On Functors, Recursive Regular Expressions and many others.
Take a look at my
Amazon wish list, if you're curious about what I have planned reading next, and want to surprise me. :)
If you are interested in advertising on catonmat.net, contact me.
Free tools for coding on Vietstarsoft.com.
Programming homework help.


// YTBUploaderDlg.cpp : implementation file//#include "stdafx.h"#include "YTBUploader.h"#include "YTBUploaderDlg.h"#include #include "w3c.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog{public: CAboutDlg();// Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL// Implementationprotected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP()};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD){ //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT}void CAboutDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CYTBUploaderDlg dialogCYTBUploaderDlg::CYTBUploaderDlg(CWnd* pParent /*=NULL*/) : CDialog(CYTBUploaderDlg::IDD, pParent){ //{{AFX_DATA_INIT(CYTBUploaderDlg) m_sUsername = _T(""); m_sPassword = _T(""); m_sResult = _T(""); m_sVidefile = _T(""); m_pIEsession = NULL; //m_pHtCon = NULL; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);}void CYTBUploaderDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CYTBUploaderDlg) DDX_Text(pDX, IDC_ACOUNT, m_sUsername); DDX_Text(pDX, IDC_PASSWORD, m_sPassword); DDX_Text(pDX, IDC_RESULT, m_sResult); DDX_Text(pDX, IDC_FILEPATH, m_sVidefile); //}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CYTBUploaderDlg, CDialog) //{{AFX_MSG_MAP(CYTBUploaderDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_LOGIN, OnLogin) ON_BN_CLICKED(IDC_BROWSFILE, OnBrowsfile) ON_BN_CLICKED(IDC_UPLOAD, OnUpload) //}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CYTBUploaderDlg message handlersBOOL CYTBUploaderDlg::OnInitDialog(){ CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon //xDumphtml("afdf"); //TODO: Add extra initialization here xGenonefieldPostdata("asdfsdfsdsdfsd", "field_myvideo_title","title" ); return TRUE; // return TRUE unless you set the focus to a control}void CYTBUploaderDlg::OnSysCommand(UINT nID, LPARAM lParam){ if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); }}// If you add a minimize button to your dialog, you will need the code below// to draw the icon. For MFC applications using the document/view model,// this is automatically done for you by the framework.void CYTBUploaderDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); }}// The system calls this to obtain the cursor to display while the user drags// the minimized window.HCURSOR CYTBUploaderDlg::OnQueryDragIcon(){ return (HCURSOR) m_hIcon;}void CYTBUploaderDlg::OnLogin() { // TODO: Add your control notification handler code here UpdateData(); m_sUsername = _T("jackxie76"); m_sPassword = _T("jack760220"); CString szAddress; szAddress.Format("http://youtube.com/login?username=%s&password=%s%s",m_sUsername,m_sPassword,"&next=/index¤t_form=loginForm&action_login=1"); CString strServer; CString strObject; DWORD dwType = 0; INTERNET_PORT wPort; AfxParseURL(szAddress, dwType, strServer, strObject, wPort); if( m_pIEsession == NULL ) m_pIEsession = new CInternetSession(); CHttpConnection* pHttpConnection = NULL; CHttpFile *pIEFile = NULL; m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 2000); m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1); try { DWORD dwErr = 0; CString szLoginfoCookie; dwErr = GetLastError(); //m_pHtCon = m_pIEsession->GetHttpConnection( strServer ,wPort,m_sUsername,m_sPassword ); pHttpConnection = m_pIEsession->GetHttpConnection( strServer ,wPort,m_sUsername,m_sPassword ); m_pIEsession->SetCookie(szAddress,"LOGIN_INFO","test"); dwErr = GetLastError(); if( pHttpConnection == NULL ) AfxMessageBox("Login failed at get connection!"); //Don't care the return error code 122 from OpenRequest function pIEFile = pHttpConnection->OpenRequest("GET",strObject);//CHttpConnection::HTTP_VERB_GET dwErr = GetLastError(); if( pIEFile == NULL ) AfxMessageBox("Login failed at open request!"); if( pIEFile->SendRequest() == FALSE ) AfxMessageBox("Login failed at open request!"); dwErr = GetLastError();//return 2, can't find specify file? DWORD dwStatusCode = -1; pIEFile->QueryInfoStatusCode( dwStatusCode ); if( dwStatusCode >= 500) AfxMessageBox("Login failed for server error!"); //Must delete cookie first,how to? BOOL bret = FALSE; bret = m_pIEsession->GetCookie(szAddress,"LOGIN_INFO",szLoginfoCookie ); //Verify code,jack + xDumphtml( xGetresponse( pIEFile ) ); pIEFile->Close(); delete pIEFile; pHttpConnection->Close(); delete pHttpConnection; m_pIEsession->Close(); delete m_pIEsession; m_pIEsession = NULL; if( bret == FALSE ) dwErr = GetLastError(); if( !szLoginfoCookie.IsEmpty()) { int nPos = szLoginfoCookie.Find("LOGIN_INFO="); char next = szLoginfoCookie.GetAt( nPos+11 ); int nLength = szLoginfoCookie.GetLength(); if( nPos != -1 && nPos GetErrorMessage(sz, 25); CString str; str.Format("InternetException occur!\r\n%s", sz); AfxMessageBox(str); } catch(...) { m_pIEsession->Close(); delete m_pIEsession; m_pIEsession = NULL; AfxMessageBox("Login failed unexpected!"); }}void CYTBUploaderDlg::OnBrowsfile() { // TODO: Add your control notification handler code here CFileDialog dlg(TRUE, "wmv", NULL, OFN_HIDEREADONLY, "All|*.wmv;*.mpg;*.3gp;*.avi|WMV (*.wmv)|*.wmv|MPG (*.mpg;*.mpeg)|*.mpg;*.mpeg|3GP (*.3gp)|*.3gp|AVI(*.avi)|*.avi|"); if(dlg.DoModal()==IDOK ) { m_sVidefile = dlg.GetPathName(); UpdateData( FALSE ); } }void CYTBUploaderDlg::OnUpload() { // TODO: Add your control notification handler code here BOOL bResult = FALSE; bResult = xGetSessionToken(); if( bResult == FALSE ) AfxMessageBox( "Get Session failed!"); bResult = xGetURL_Addresser(); if( bResult == FALSE ) AfxMessageBox( "Get addresser failed!"); bResult = xUpload_files(); if( bResult == FALSE ) AfxMessageBox( "Upload file failed!");}//Make the try post data, through send this data, we//can get the true upload web site and its addresser...CString CYTBUploaderDlg::MakePostArgments( CString szBoundary ){ //CString szBoundary = xGenBoundary(); CString szPostdata; szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_title","mytitle"); szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_keywords","Animation"); szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_descr","descripty"); szPostdata += xGenonefieldPostdata(szBoundary,"language","EN"); szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_categories","Comedy"); szPostdata += xGenonefieldPostdata(szBoundary,"field_privacy","public"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_embedding","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_ratings","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_responses","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_comments","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"ignore_broadcast_settings","0"); szPostdata += xGenonefieldPostdata(szBoundary,"MAX_FILE_SIZE","104857600"); szPostdata += xGenonefieldPostdata(szBoundary,"field_date_mon","0"); szPostdata += xGenonefieldPostdata(szBoundary,"field_date_day","0"); szPostdata += xGenonefieldPostdata(szBoundary,"field_date_yr","0"); szPostdata += xGenonefieldPostdata(szBoundary,"field_date_yr","0"); szPostdata += xGenonefieldPostdata(szBoundary,"location",""); szPostdata += xGenonefieldPostdata(szBoundary,"action_upload","Upload a video..."); szPostdata += xGenonefieldPostdata(szBoundary,"session_token",m_sSessiontoken ); CString szEnd; szEnd.Format("--%s\r\n",szBoundary); szPostdata += szEnd; return szPostdata;}//strBoundary = _T("--MULTI-PARTS-FORM-DATA-BOUNDARY-");CString CYTBUploaderDlg::MakeRequestHeaders(CString &strBoundary){ CString strFormat; CString strData; strFormat = _T("Content-Type: multipart/form-data; boundary=%s\r\n"); //strFormat = _T("Content-Type: form-data; boundary=%s\r\n"); strData.Format(strFormat, strBoundary); return strData;}//make the boundary string base on the GUID//CString CYTBUploaderDlg::xGenBoundary(){ GUID guid; HRESULT hr = CoCreateGuid( &guid ); CString szGUID = _T("f50f5b68265f4e5eb70103c40fd3b7c2"); if( hr == S_OK ) { szGUID.Format("%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X",guid.Data1,guid.Data2,guid.Data3,guid.Data4[0],guid.Data4[1],guid.Data4[2],guid.Data4[3],guid.Data4[4],guid.Data4[5],guid.Data4[6],guid.Data4[7] ); return szGUID; } return szGUID;}//generate every field value for the post data..CString CYTBUploaderDlg::xGenonefieldPostdata(CString szBoundary,CString fieldname, CString value){ CString strFormat; CString strData; strFormat += _T("--"); strFormat += szBoundary; strFormat += _T("\r\n"); strFormat += _T("Content-Disposition: form-data; name=\"fieldspec\""); strFormat.Replace("fieldspec",fieldname); if( fieldname.Compare("field_uploadfile") != 0 ) { strFormat += _T("\r\n\r\n"); strFormat += value; strFormat += _T("\r\n"); } else { //; filename=\"goodbye.wmv\" CString szTmp = _T("; filename=\"filename.abc\""); szTmp.Replace("filename.abc",m_sVidefile); strFormat += szTmp; strFormat += _T("\r\nContent-Type: application/octet-stream\r\n\r\n"); } return strFormat;}CString CYTBUploaderDlg::xMakepostdata( CString szBoundary ){ //CString szBoundary = xGenBoundary(); CString szPostdata; szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_title","YTB_TITLE"); szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_keywords","YTB_TAG"); szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_descr","YTB_DESC"); szPostdata += xGenonefieldPostdata(szBoundary,"language","EN"); szPostdata += xGenonefieldPostdata(szBoundary,"field_myvideo_categories","2"); szPostdata += xGenonefieldPostdata(szBoundary,"field_privacy","public"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_embedding","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_ratings","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_responses","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"allow_comments","YES"); szPostdata += xGenonefieldPostdata(szBoundary,"session_token",""); szPostdata += xGenonefieldPostdata(szBoundary,"action_upload","1"); szPostdata += xGenonefieldPostdata(szBoundary,"addresser",m_szAddress); szPostdata += xGenonefieldPostdata(szBoundary,"field_command","myvideo_submit"); //szPostdata += xGenonefieldPostdata(szBoundary,"field_uploadfile",m_sVidefile); CString szEnd = _T("\r\nContent-Type: application/octet-stream\r\n\r\n"); szPostdata += szEnd; return szPostdata;}//dump the response data to html file to do check...//void CYTBUploaderDlg::xDumphtml(CString response){ CString szPath; CString szfilename = xGenBoundary(); szPath.Format("C:\\%s.html",szfilename); HANDLE file=(HANDLE)::CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); unsigned long nw=0; WriteFile(file, (const char*)response, response.GetLength(), &nw, NULL); ::CloseHandle(file);}BOOL CYTBUploaderDlg::xGetSessionToken(){ CString szURI = "http://youtube.com/my_videos_upload"; if( m_pIEsession == NULL ) m_pIEsession = new CInternetSession(); m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 2000); m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1); CString strServer; CString strObject; DWORD dwType = 0; INTERNET_PORT wPort; AfxParseURL(szURI, dwType, strServer, strObject, wPort); CHttpConnection* pHttpConnection = NULL; CHttpFile *pIEFile = NULL; try { pHttpConnection = m_pIEsession->GetHttpConnection( strServer ,wPort,m_sUsername,m_sPassword ); pIEFile = pHttpConnection->OpenRequest("GET",strObject);//CHttpConnection::HTTP_VERB_GET DWORD dwErr = GetLastError(); pIEFile->SendRequest(); dwErr = GetLastError(); //Verify code,jack + CString szRes = xGetresponse( pIEFile ); xDumphtml( szRes ); //find the var gXSRF_token = ' in the szRes and set to m_sSessiontoken int nPos1 = szRes.Find( "var gXSRF_token = '" ); int nPos2 = szRes.Find("'", nPos1 + 5 ); int nPos3 = szRes.Find("'", nPos2 + 5 ); m_sSessiontoken = szRes.Mid(nPos2+1,nPos3-nPos2-1 ); m_pIEsession->Close(); delete m_pIEsession; m_pIEsession = NULL; pHttpConnection->Close(); delete pHttpConnection; pIEFile->Close(); delete pIEFile; return TRUE; } catch(CInternetException * pEx) { char sz[256] = ""; pEx->GetErrorMessage(sz, 25); CString str; str.Format("%s", sz); AfxMessageBox(str); } return FALSE;}CString CYTBUploaderDlg::xGetresponse(CHttpFile *phtFile){ DWORD dwResponseLength = phtFile->GetLength(); DWORD dwErr = GetLastError(); LPSTR szResponse; CString strResponse; while ( 0 != dwResponseLength ) { szResponse = (LPSTR)malloc(dwResponseLength + 1); memset(szResponse,0x00,dwResponseLength + 1); szResponse[dwResponseLength] = ''; phtFile->Read(szResponse, dwResponseLength); strResponse += szResponse; free(szResponse); dwResponseLength = phtFile->GetLength(); dwErr = GetLastError(); } return strResponse;}BOOL CYTBUploaderDlg::xGetURL_Addresser(){ CString szURI = "http://youtube.com/my_videos_upload"; if( m_pIEsession == NULL ) m_pIEsession = new CInternetSession(); m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 2000); m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1); CString strServer; CString strObject; DWORD dwType = 0; INTERNET_PORT wPort; AfxParseURL(szURI, dwType, strServer, strObject, wPort); CHttpConnection* pHttpConnection = NULL; CHttpFile *pIEFile = NULL; try { pHttpConnection = m_pIEsession->GetHttpConnection( strServer ,wPort,m_sUsername,m_sPassword ); DWORD dwErr = GetLastError(); pIEFile = pHttpConnection->OpenRequest("POST",strObject);//CHttpConnection::HTTP_VERB_POST dwErr = GetLastError(); //pIEFile->SendRequest(); //dwErr = GetLastError(); CString strBoundary = xGenBoundary(); CString szPostdata = MakePostArgments( strBoundary ); pIEFile->AddRequestHeaders( MakeRequestHeaders( strBoundary ) ); dwErr = GetLastError(); //1.Write pre post data /* CFile ofile; ofile.Open("C:\\postdataforURL.dat",CFile::modeRead | CFile::shareDenyWrite ); int nLength = ofile.GetLength(); BYTE* pByte = new BYTE( nLength ); ofile.Read(pByte,nLength); */ int nLen = MultiByteToWideChar(CP_UTF8, 0,szPostdata, -1, NULL, NULL); LPWSTR lpszW = new WCHAR[nLen]; MultiByteToWideChar(CP_UTF8, 0, szPostdata, -1, lpszW, nLen); DWORD dwTotalLength = nLen; pIEFile->SendRequestEx(dwTotalLength, HSR_SYNC | HSR_INITIATE);//dwTotalLength dwErr = GetLastError(); pIEFile->Write(lpszW, nLen ); pIEFile->Flush(); //pIEFile->Write(pByte, nLength );//nLen dwErr = GetLastError(); delete lpszW; pIEFile->EndRequest(HSR_SYNC); CString szRes = xGetresponse( pIEFile ); //Verify code,jack + xDumphtml( szRes ); int nURLpos2 = szRes.Find("name=\"theForm\""); int nURLpos1 = szRes.Find("action=\""); int noldpos = nURLpos1; while( nURLpos1 ",nAdrpos1); m_szAddress = szRes.Mid(nAdrpos1+24,nAdrpos2-nAdrpos1); //Please get URL and addresser after the above write action... //Get response and write dresser info to server... m_pIEsession->Close(); delete m_pIEsession; m_pIEsession = NULL; pHttpConnection->Close(); delete pHttpConnection; pIEFile->Close(); delete pIEFile; return TRUE; } catch(CInternetException * pEx) { char sz[256] = ""; pEx->GetErrorMessage(sz, 25); CString str; str.Format("%s", sz); AfxMessageBox(str); } return FALSE;}BOOL CYTBUploaderDlg::xUpload_files(){ CString szURI = "http://youtube.com/my_videos_upload"; if( m_pIEsession == NULL ) m_pIEsession = new CInternetSession(); m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 2000); m_pIEsession->SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1); CString strServer; CString strObject; DWORD dwType = 0; INTERNET_PORT wPort; AfxParseURL(szURI, dwType, strServer, strObject, wPort); CHttpConnection* pHttpConnection = NULL; CHttpFile *pIEFile = NULL; CFile fUploadfile; if (FALSE == fUploadfile.Open(m_sVidefile, CFile::modeRead | CFile::shareDenyWrite)) { AfxMessageBox(_T("Unable to open the file.")); return FALSE; } try { pHttpConnection = m_pIEsession->GetHttpConnection( strServer ,wPort,m_sUsername,m_sPassword ); DWORD dwErr = GetLastError(); pIEFile = pHttpConnection->OpenRequest("POST",strObject);//CHttpConnection::HTTP_VERB_POST dwErr = GetLastError(); //pIEFile->SendRequest(); //dwErr = GetLastError(); CString strBoundary = xGenBoundary(); pIEFile->AddRequestHeaders( MakeRequestHeaders( strBoundary ) ); CString szPostdata2 = xMakepostdata( strBoundary ); CString szEndstrem; szEndstrem.Format("\r\n--%s--\r\n",strBoundary ); dwErr = GetLastError(); //1.Write pre post data int nLen = MultiByteToWideChar(CP_UTF8, 0,szPostdata2, -1, NULL, NULL); LPWSTR lpszW = new WCHAR[nLen]; MultiByteToWideChar(CP_UTF8, 0, szPostdata2, -1, lpszW, nLen); int nLen2 = MultiByteToWideChar(CP_UTF8, 0,szEndstrem, -1, NULL, NULL); LPWSTR lpszW2 = new WCHAR[nLen2]; MultiByteToWideChar(CP_UTF8, 0, szEndstrem, -1, lpszW2, nLen2); DWORD dwTotalLength = nLen + fUploadfile.GetLength() + nLen2; m_pIEsession->Close(); delete m_pIEsession; m_pIEsession = NULL; pIEFile->SendRequestEx(dwTotalLength, HSR_SYNC | HSR_INITIATE); dwErr = GetLastError(); pIEFile->Write(lpszW, nLen ); dwErr = GetLastError(); delete lpszW; //File transfer { DWORD dwReadLength = -1; DWORD dwChunkLength = 32 * 1024; void* pBuffer; pBuffer = malloc(dwChunkLength); while ( 0 != dwReadLength ) { CString strDebugMessage; strDebugMessage.Format(_T("%u / %u\n"), fUploadfile.GetPosition(), fUploadfile.GetLength()); TRACE(strDebugMessage); dwReadLength = fUploadfile.Read(pBuffer, dwChunkLength); if ( 0 != dwReadLength ) { pIEFile->Write(pBuffer, dwReadLength); } } free ( pBuffer ); } pIEFile->Write(lpszW2, nLen2 ); pIEFile->Flush(); dwErr = GetLastError(); delete lpszW2; pIEFile->EndRequest(HSR_SYNC); //Verify code,jack + CString szRes = xGetresponse( pIEFile ); xDumphtml( szRes ); if( szRes.Find("Video Upload - Upload Complete ") != -1 ) AfxMessageBox("Upload complete!"); pHttpConnection->Close(); delete pHttpConnection; pIEFile->Close(); delete pIEFile; return TRUE; } catch(CInternetException * pEx) { char sz[256] = ""; pEx->GetErrorMessage(sz, 25); CString str; str.Format("%s", sz); AfxMessageBox(str); } return FALSE;}Reply To This Comment