Link to home
Start Free TrialLog in
Avatar of jabarooth
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","administrator","tema");
            if(pConnection->SetCurrentDirectory("EMMCDROM"))
{
  if(pConnection->PutFile("C:\\test.html","test.html"))
  AfxMessageBox("Success");//DbgMsg("Out put path %s filename=%s filepath=%s ",outpath,filename,filepath);
else
{
AfxMessageBox("Failure");//DbgMsg("File 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(buffer,1024);
AfxMessageBox("InternetException");
pEx->Delete();
pConnection = NULL;
return FALSE;
}
Avatar of jabarooth
jabarooth

ASKER

Edited text of question.
Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of RAVID
RAVID

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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
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