procedure TForm_Main.B_imageClick(Sender: TObject);
var
locafile,remotefile:string;
begin
table1.DisableConstraints;
if OpenPicture.Execute and nmftp1.Connected then
begin
locafile:=OpenPicture.FileName;
try
table1.Edit;
table1.FieldValues['images']:=ExtractFileName(locafile);
table1.Post;
except end;
if FileExists(str+'/images/'+table1.FieldByName('images').value) then
Image1.Picture.LoadFromFile(str+'/images/'+table1.FieldByName('images').value)
else
image1.Picture.loadfromfile(str+'/images/blank.jpg');
table1.EnableConstraints;
try
remotefile:=ExtractFileName(openpicture.FileName);
NMFTP1.Upload(locafile,remotefile);
except
On E:Exception do
writeln(E.message);
end;
end
else
showmessage('没有选定图片文件!');
end;