Z
zlyanyan
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button5Click(Sender: TObject);
var
LocalFile,
RemoteFile: String;
F: File of Byte;
FSize: Integer;
O: TOpenDialog;
begin
O := TOpenDialog.Create(Self);
try
O.Title := '选择要上传的文件';
if O.Execute then
if InputQuery('为上传的文件在服务器上命名', '请输入上传到的(文件夹及)文件名?', RemoteFile) then
begin
LocalFile := O.FileName;
case RadioGroup1.ItemIndex of
0: NMFTP1.Mode(MODE_ASCII);
1: NMFTP1.Mode(MODE_IMAGE);
2: NMFTP1.Mode(MODE_BYTE);
end;
AssignFile(F, LocalFile);
Reset(F);
FSize := FileSize(F);
CloseFile(F);
NMFTP1.Allocate(FSize);
NMFTP1.Upload(LocalFile, RemoteFile);
end;
finally
O.Free;
end;
end;
var
LocalFile,
RemoteFile: String;
F: File of Byte;
FSize: Integer;
O: TOpenDialog;
begin
O := TOpenDialog.Create(Self);
try
O.Title := '选择要上传的文件';
if O.Execute then
if InputQuery('为上传的文件在服务器上命名', '请输入上传到的(文件夹及)文件名?', RemoteFile) then
begin
LocalFile := O.FileName;
case RadioGroup1.ItemIndex of
0: NMFTP1.Mode(MODE_ASCII);
1: NMFTP1.Mode(MODE_IMAGE);
2: NMFTP1.Mode(MODE_BYTE);
end;
AssignFile(F, LocalFile);
Reset(F);
FSize := FileSize(F);
CloseFile(F);
NMFTP1.Allocate(FSize);
NMFTP1.Upload(LocalFile, RemoteFile);
end;
finally
O.Free;
end;
end;