我用delphi 自带ftp上传文件为啥只能上传英文文件名的资料 
ftp.put(PChar(opendialog1.FileName),filename,FALSE);
上传中文文件名的的就会提示Project GreenOA.exe raised exception class EIdProtocolReplyError with message '/??.doc: Cannot create file错误。

解决方案 »

  1.   

    没有试,从现象猜测是字符集问题,internet的7bit字符集和GB字符集传输出错了.
      

  2.   

    用INDY 中的试一下,
    目录不要太长,另外不要有太多的其它字符,如:空格 括号等。
      

  3.   

    文件目录中 不能有 空格 如 :   c:\123 456\xx.iso最好用 ics 控件做个 ftp  简单稳定 不用 indy另外 当文件大小超过 2G时  就不能上传了 需要该 原代码
      

  4.   

    还是不行,我用ics写的也是有我问题。。
    if ftp1.Connected then ftp1.Quit;
      ftp1.Username:='greenway';
      ftp1.Passive:=true;  ftp1.password:='';
      ftp1.hostname:=';
      ftp1.Connect;
      if   ftp1.Connected=true   then
      begin
       ftp1.LocalFileName:=filedir+filename;
       Ftp1.HostFileName:=filename;
       ftp1.Put;
      end;
    这样写好像也是有问题,传上去的文件只有扩展名
      

  5.   

    把你的 文件目录名+文件名  贴出来 我的 ics   ftp  上传线程部分代码(仅供参考)  没有问题的 
    unit FtpPut;interfaceuses
      Classes,UMirrorSend,dialogs,SysUtils,idftp;type
      ftpThd = class(TThread)
      private
        { Private declarations }
        CreateFileName:String;
        ProName:String;
      protected
        procedure Execute; override;
      public
        constructor Create(StreamFile:String;FilesName:String);
        procedure putfile;
      end;implementationuses Math;{ Important: Methods and properties of objects in visual components can only be
      used in a method called using Synchronize, for example,      Synchronize(UpdateCaption);  and UpdateCaption could look like,    procedure ftp3.UpdateCaption;
        begin
          Form1.Caption := 'Updated in a thread';
        end; }{ ftp3 }constructor ftpThd.Create(StreamFile:String;FilesName:String);
    begin
      CreateFileName :=StreamFile ;
      ProName :=FilesName ;  FreeOnTerminate := True;
      inherited Create(False);
    end;procedure ftpThd.Execute;
    var
        fstream: TFileStream ;
        begin
    try
      fstream := TFileStream.Create(CreateFileName,fmOpenRead);
    except
      //ShowMessage('读取文件出错');
      Abort;
    end; { if not Form1.IdFTP2.Connected then
      begin
        ShowMessage('err');
        fstream.Free;
      end;}try
      {ftp1:=TIdFTP.Create(nil);
      with ftp1 do
      begin
      Host :='124.0.0.188';
      Port :=23;
      Username :='system';
      Password :='system';
      Connect();
      end;}  frmMirrorSend.ftpClient.put(fstream,ProName ,False );  Synchronize(putfile );
    finally
      fstream.Free;
      Terminate ;end;
      { Place thread code here }
    end;procedure ftpThd.putfile;
    begin  //frmMirrorSend.ggFileSend.Progress :=0;
      ShowMessage('上传完毕111!');
      //frmMirrorSend.lvFileList.Items[2].Caption  := '已发送';
      { Place thread code here }
    end;end.
      

  6.   

    上传文件的 目录是C:\Documents and Settings\syf\My Documents\厦门东通道维护制度.doc'