FTP上传多个文件,文件大小不对!Help!!!(100分)

C

clapper

Unregistered / Unconfirmed
GUEST, unregistred user!
用 NMFTP 上传多个文件,结果传过去的每个文件大小都变成 1615360,
但是传单个文件没问题,真是怪呀!
各为大侠,帮帮忙啊!
 
我也遇到这样的问题了
不知道你怎么解决的
var
i: Integer;
begin
for I:=0 to FileListBox1.Items.Count-1 do
if FileListBox1.selected then
begin
IdFTP1.Put(FileListBox1.filename,extractfilename(FileListBox1.Items.Strings));
SetFunctionButtons(false);
IdFTP1.TransferType := ftBinary;
ChageDir(idftp1.RetrieveCurrentDir);
SetFunctionButtons(true);
end;
end;
文件发出以后到远端都一样大小
谁解决掉给100分

 
那就一个一个的传嘛! 何必这么叫真.[:D]
 
如果是一万多个文件怎么办
 
如果说一个文件能UPLOAD没问题的话!

那就变通一下方法: 将你的FTP控件动态生成(用的时候生成并设置相应属性), 传完一个就FREE掉, 如此循环不是也就行了!

类似代码:

for i := 0 to 100000
begin
CreateFTPClientComponent;
UploadFile;
FreeFTPClientComponent
end;
 
我用的是indy IdFTP呀,不是NMFTP
 
那不都一样嘛.

不管用什么控件, 如果你说是一次一个OK, 一次多个不OK. 那就在传递时才创建你的控件![:)]
 
大哥能把这段代码给我修改以下吗?
var
i: Integer;
begin
for I:=0 to FileListBox1.Items.Count-1 do
if FileListBox1.selected then
begin
IdFTP1.Put(FileListBox1.filename,extractfilename(FileListBox1.Items.Strings));
SetFunctionButtons(false);
IdFTP1.TransferType := ftBinary;
ChageDir(idftp1.RetrieveCurrentDir);
SetFunctionButtons(true);
end;
end;
100分给你
 
我传输一个文件断开连接一下
var
i: Integer;
begin
for I:=0 to FileListBox1.Items.Count-1 do
if FileListBox1.selected then begin
if IdFTP1.Connected then
IdFTP1.Disconnect;
IdFTP1.Connect;
IdFTP1.Put(FileListBox1.filename,extractfilename(FileListBox1.Items.Strings));
SetFunctionButtons(false);
IdFTP1.TransferType := ftBinary;
ChageDir(idftp1.RetrieveCurrentDir);
SetFunctionButtons(true);
IdFTP1.Disconnect
end;
end;
还不行
 
我做了一个简单的例子试了一下,选择一个文件还是多个文件一起上传都没什么问题!

http://www.sj888888.com/ftp.rar

服务器用的IIS自带的FTP服务器!
有问题来信吧! (gear1023@163.com)[:)]
 
顶部