你可以先用Windows自带的ftp.exe试一下。在你的程序PutFile之后,看它能不能删除?

解决方案 »

  1.   

    putfile(上传文件)后可以立即删除,
    但是getfile(下载文件)后文件(自认为处于打开状态)再删除将无法删除,
    服务器方手工删除也报告文件正在使用,不能删除,只有重启动.
    问:如和在getfile后关闭文件.万分感激!!!
    .我写的是一个FTP-OCX控件:代码如下:
     pFTPcon=eSession.GetFtpConnection(m_remoteAddress,m_userName,m_password);BOOL CFTPCtrl::GetFile() file://下载文件
    {
    pFTPcon->SetCurrentDirectory(m_remoteDirectory);
        CString strTemp;
     CString strAdd="\\";
     strTemp=m_localDirectory;
     if(strTemp.GetLength()==3)
     {
      strTemp.Insert(strTemp.GetLength(),m_localFile);
     }
     else
     {
      strTemp.Insert(strTemp.GetLength(),strAdd);
      strTemp.Insert(strTemp.GetLength(),m_localFile);
     }
     pFTPcon->GetFile(m_remoteFile,strTemp,FALSE);
     return TRUE;
    }BOOL CFTPCtrl::PutFile() file://上传文件
    {
     // TODO: Add your dispatch handler code here
     pFTPcon->SetCurrentDirectory(m_remoteDirectory);
     CString strTemp;CString strAdd;strAdd="\\";
     strTemp=m_localDirectory;
     if(strTemp.GetLength()==3)
     {
      strTemp.Insert(strTemp.GetLength(),m_localFile);
     }
     else
     {
      strTemp.Insert(strTemp.GetLength(),strAdd);
      strTemp.Insert(strTemp.GetLength(),m_localFile);
     }
     if(m_binary==TRUE)
     {return pFTPcon->PutFile(strTemp,m_remoteFile);}
     else
     {return pFTPcon->PutFile(strTemp,m_remoteFile,FTP_TRANSFER_TYPE_ASCII);}
    }
      

  2.   

    下载文件后QUIT一下,关掉Session试试?
      

  3.   

    我在用GetFile(下载文件)后关闭pFTPcon.close后,也不行.
    谢谢再赐教!!!
      

  4.   

    呵呵。你可以试试下面的方法:
    先get;
    再put;
    再delete;
    不要笑我。
      

  5.   

    同样的问题,同样的说明,sigh..
    PutFile is a high-level routine that handles all of the operations associated with storing a file on an FTP server. Applications that only send data, or that require closer control over the file transfer, should use OpenFile and CInternetFile::Write.