Click here to Skip to main content
15,919,121 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
This is an upload files program.
but return value from putfile is 0(false).what is wrong?

C++
void CUploadFilesDlg::OnUploadFiles()
{
	CFtpConnection *m_pFtpConnection;
	CInternetSession m_Session;
	m_pFtpConnection = NULL;

	try
	{

		m_pFtpConnection = m_Session.GetFtpConnection(_T("filegenie.com"),
			_T("rezaeefatima"),_T("2502-DRMB"),INTERNET_INVALID_PORT_NUMBER);
	}
	catch(CInternetException *pEx)
	{
		pEx->ReportError(MB_ICONEXCLAMATION);
		m_pFtpConnection = NULL;
		pEx->Delete();
	}

	CFileFind Finder;
	CString strFileName;
	ULONG len;

	if(Finder.FindFile(m_txtFileName)==TRUE)
	{
		Finder.FindNextFile();
		strFileName = Finder.GetFileName();
		len = Finder.GetLength();
		Finder.Close();
	}
	
	BOOL bUploaded = m_pFtpConnection->PutFile(m_txtFileName,
		strFileName,FTP_TRANSFER_TYPE_BINARY,1);
	if (bUploaded == TRUE)
		AfxMessageBox(_T("Uploaded Successfully"));
	else
		AfxMessageBox(_T("Uploaded Does not Successfully"));
	

}

please help
Posted
Comments
André Kraak 19-Oct-13 7:56am    
Try using GetLastError()[^] to determine the cause of the error.
Hanoi 2014 19-Oct-13 8:15am    
Thanks for quick help,
This is the error:
ERROR_WINHTTP_TIMEOUT12002
The request has timed out.
Richard MacCutchan 19-Oct-13 8:50am    
It means you are not getting valid responses from the server; check the server logs.

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