我用delphi 自带ftp上传文件为啥只能上传英文文件名的资料
ftp.put(PChar(opendialog1.FileName),filename,FALSE);
上传中文文件名的的就会提示Project GreenOA.exe raised exception class EIdProtocolReplyError with message '/??.doc: Cannot create file错误。
ftp.put(PChar(opendialog1.FileName),filename,FALSE);
上传中文文件名的的就会提示Project GreenOA.exe raised exception class EIdProtocolReplyError with message '/??.doc: Cannot create file错误。
解决方案 »
- StrCopy()怎么用啊?
- 关于cxLookupComboBox的一个很奇怪的问题。。。。
- vc写的dll文件,在BCB中调进用正常,我在DELPHI中调用不成功,请大家帮助解决一下!
- 初学,请问LoadFromfile运行的条件是什么?
- 用SYBASE 的高手帮忙指点以下,很简单的
- Delphi应该不能实现这个功能吧!
- 大虾留步:delphi中类的问题
- 那有比较全的DELPHI函数的资料??我给50分,分几次给,一次只能给24分
- 资源文件的冲突?
- 如何取得弹出的子窗口的句柄?????????!!!!!!
- DELPHI怎么向webbrows发送打开网址的要求呢?
- 和QQ、MSN左下角新闻问题?
目录不要太长,另外不要有太多的其它字符,如:空格 括号等。
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;
这样写好像也是有问题,传上去的文件只有扩展名
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.