jabarooth
asked on
PutFile function is failing(synchronous mode)
In the Below code Putfile function is failing, and GetLastError is saying that File is not found. But i have the file in my local system, I want to upload that file to FTP server.
Thank you.
CInternet sess;
CFtpConnection* pConnection = NULL;
try
{
pConnection = sess.GetFtpConnection("EMM _PDC","adm inistrator ","tema");
if(pConnection->SetCurrent Directory( "EMMCDROM" ))
{
if(pConnection->PutFile("C :\\test.ht ml","test. html"))
AfxMessageBox("Success");/ /DbgMsg("O ut put path %s filename=%s filepath=%s ",outpath,filename,filepat h);
else
{
AfxMessageBox("Failure");/ /DbgMsg("F ile transfer failed %d",GetLastError());
return FALSE;
}
}
else
{
AfxMessageBox("Setting current directory in FTP Server failed.");
return FALSE;
}
}
catch (CInternetException* pEx)
{
TCHAR buffer[1024];
pEx->GetErrorMessage(buffe r,1024);
AfxMessageBox("InternetExc eption");
pEx->Delete();
pConnection = NULL;
return FALSE;
}
Thank you.
CInternet sess;
CFtpConnection* pConnection = NULL;
try
{
pConnection = sess.GetFtpConnection("EMM
if(pConnection->SetCurrent
{
if(pConnection->PutFile("C
AfxMessageBox("Success");/
else
{
AfxMessageBox("Failure");/
return FALSE;
}
}
else
{
AfxMessageBox("Setting current directory in FTP Server failed.");
return FALSE;
}
}
catch (CInternetException* pEx)
{
TCHAR buffer[1024];
pEx->GetErrorMessage(buffe
AfxMessageBox("InternetExc
pEx->Delete();
pConnection = NULL;
return FALSE;
}
ASKER
Edited text of question.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Thank you for reply, i tried the samething before it is giving the same error. When i try to execute the FTPTREE sample given in VC++ CD for uploading, it is giving access denied error. But in GetFTPConnection function i passed administrator account. Is there any other kind of rights i need for uploading the file in the server side.
Thank you.
Thank you for reply, i tried the samething before it is giving the same error. When i try to execute the FTPTREE sample given in VC++ CD for uploading, it is giving access denied error. But in GetFTPConnection function i passed administrator account. Is there any other kind of rights i need for uploading the file in the server side.
Thank you.
ASKER
Hi
I can able to open the file in the Remote FTP server and also i can read that file. Problem is during uploading.
Thank you
I can able to open the file in the Remote FTP server and also i can read that file. Problem is during uploading.
Thank you
ASKER
Hi
I can able to open the file in the Remote FTP server and also i can read that file. Problem is during uploading.
Thank you
I can able to open the file in the Remote FTP server and also i can read that file. Problem is during uploading.
Thank you
ASKER