Login  
Search All Forums
Dart Home | PowerTCP FTP for ActiveX | Custom Development Reply | PowerTCP FTP for ActiveX Topics | Forums   
AuthorForum: PowerTCP FTP for ActiveX
Topic: Can put but not get
kberson
keith.berson@nuance.com

From: Burlington, MA USA
Posts: 42
Member Since: 12/11/01
posted January 17, 2002 3:37 PM

I have been getting the same error all morning trying to use VisualC++ FTP Get file: Access Denied. It reached the point where I convinced my boss that we needed the Dart FTP tool in order to make the project work. I downloaded the trial version; I replaced my FTP code with the Dart calls to Store and Retrieve (fortunately, I've been using the MailTool and ZipTool, and was able to quickly make the change).

But now I'm back to the same place!! My put works like a champ -- I'm even getting % complete out of Ftp_Progress(). But the error for the get (ie, retrieve) is Access Denied! I am checking my values against the client sample code and everything is the same, and yet that runs.

I was having a problem with the put (store), but changing the passive setting fixed that. 

One thing I know that is different is I am using the full path name for getting the remote file; do I need to be in the same directory?
kberson
keith.berson@nuance.com

From: Burlington, MA USA
Posts: 42
Member Since: 12/11/01
posted January 17, 2002 4:14 PM

One other thing I've found -- I don't have the size of the remote file. Do I need to have that?
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted January 17, 2002 5:06 PM


Hi,
No.
Does changing the directory to that of the file work?
Thanks,
-ken

K M Drake
Dart Tech Support
kberson
keith.berson@nuance.com

From: Burlington, MA USA
Posts: 42
Member Since: 12/11/01
posted January 18, 2002 8:33 AM

No, changing the directory made no difference. I added logging to my code in the Ftp_Progress, and I can see the change directory command going down. However, I don't see the set Passive. I added the same logging to the sample, and there I do see the message, "Entering Passive Mode".

Here is my code for doing the get:

bool FtpInfo::GetFile(CString &remoteFile,CString &localFile)
{
  // set the root dir as cwd
  ftp->Directory = _bstr_t("/");
  ftp->GetDirectory();
 
  short pos = remoteFile.ReverseFind('/');
  CString cdir,dir = remoteFile.Mid(1, pos-1 ),file = remoteFile.Mid(pos+1);
  pos = -1;
  do
  {
   pos = dir.Find('/',pos+1);
   if( pos != -1 )
   {
     cdir = dir.Left( pos );
     dir = dir.Mid(pos+1);
   }
   else
     cdir = dir;

   ftp->Directory = _bstr_t(cdir);
   cdir = (char *)ftp->GetDirectory();
  }
  while( pos != -1 );


  ftp->Type = DartFtp::ftpImage;

  char fpath[4096];
  _fullpath(fpath,localFile,sizeof(fpath));
  COleVariant ovLocalFile;
  ovLocalFile = fpath;

  bool flag = false;
  try
  {
   ftp->TimeOut = 30000;
   ftp->Passive = TRUE;
   ftp->ProxyType = DartFtp::ftpProxyNone;
   ftp->ProxyUsername = _bstr_t("");
   ftp->ProxyPassword = _bstr_t("");
   ftp->ProxyHost = _bstr_t("");
   ftp->ProxyPort = 1080;

   DWORD localFileSize = 0;
   ftp->Retrieve( _bstr_t(file), ovLocalFile, localFileSize);
   flag = true;
  }
  catch(...)
  {
  }
  return flag;
}

I have tried ftp->Passive as both TRUE and FALSE, and I am still getting the same error.

Do you see anything?
kberson
keith.berson@nuance.com

From: Burlington, MA USA
Posts: 42
Member Since: 12/11/01
posted January 18, 2002 9:36 AM

Correction: I do see the passive message when I set ftp->Passive to TRUE. I was hoping that was the problem.

I also am able to get rid of code to walk down to the directory I want:

 short pos = remoteFile.ReverseFind('/');
 CString dir = remoteFile.Left(pos),file = remoteFile.Mid(pos+1);

 ftp->Directory = _bstr_t(dir);
 dir = (char *)ftp->GetDirectory();

puts me right into the directory where my file is.
kberson
keith.berson@nuance.com

From: Burlington, MA USA
Posts: 42
Member Since: 12/11/01
posted January 18, 2002 9:59 AM

Never mind; forrest for the trees. I didn't notice that my file name had was wrong; as soon as I fixed that error, everything went.

Thanks!
Reply | PowerTCP FTP for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX