function GetFileSize(const FileName : TFileName) : Integer; var SearchRec : TSearchRec; begin Result := 0; if not FileExists(FileName) then exit; FindFirst(FileName, faAnyFile, SearchRec); Result := SearchRec.Size; FindClose(SearchRec); end;
procedure TForm1.IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer); begin if AWorkMode = wmWrite then if AWorkCount > 10000 then IdFTP1.Disconnect; end;
Jeg tror han har tænkt sig at lave en demo version til sit ftp prog. Og jeg kunne ikke forestille mig noget mere irriterende end en fil som stoppede med at uploade halvvejs.
function FileSize(FileName : String) : Integer; var SearchRec : TSearchRec; begin FindFirst(FileName, faAnyFile, SearchRec); FindClose(SearchRec); Result := SearchRec.Size; end;
function GetFileSize(FileName : String) : Integer; var SearchRec : TSearchRec; begin FindFirst(FileName, faAnyFile, SearchRec); FindClose(SearchRec); Result := SearchRec.Size; end;
procedure TMainForm.UploadButtonClick(Sender: TObject); var FileName : TFileName; begin if not UploadOpenDialog1.Execute then exit;
FileName := UploadOpenDialog1.Filename;
if GetFileSize(Filename) > 1e6 then //ca 1 mb exit:
if IdFTP1.Connected then begin try SetFunctionButtons(false); IdFTP1.TransferType := ftBinary; IdFTP1.Put(FileName, ExtractFileName(FileName)); ChageDir(idftp1.RetrieveCurrentDir); finally SetFunctionButtons(true); end; end; end;
[Error] mainf.pas(187): Undeclared identifier: 'UploadOpenDialog1' [Error] mainf.pas(187): 'THEN' expected but identifier 'Execute' found [Error] mainf.pas(193): ':=' expected but ':' found [Error] mainf.pas(195): Operator not applicable to this operand type [Error] mainf.pas(198): Undeclared identifier: 'SetFunctionButtons' [Error] mainf.pas(199): Missing operator or semicolon [Error] mainf.pas(200): Missing operator or semicolon [Error] mainf.pas(201): Undeclared identifier: 'ChageDir' [Error] mainf.pas(201): Missing operator or semicolon [Error] mainf.pas(201): EXCEPT or FINALLY expected [Error] mainf.pas(205): '.' expected but ';' found [Warning] mainf.pas(206): Text after final 'END.' - ignored by compiler [Error] mainf.pas(69): Unsatisfied forward or external declaration: 'TMainForm.UploadButtonClick' [Error] mainf.pas(70): Unsatisfied forward or external declaration: 'TMainForm.DirectoryListBoxDblClick' [Error] mainf.pas(71): Unsatisfied forward or external declaration: 'TMainForm.DeleteButtonClick' [Error] mainf.pas(72): Unsatisfied forward or external declaration: 'TMainForm.IdFTP1Disconnected' [Error] mainf.pas(73): Unsatisfied forward or external declaration: 'TMainForm.AbortButtonClick' [Error] mainf.pas(74): Unsatisfied forward or external declaration: 'TMainForm.BackButtonClick' [Error] mainf.pas(75): Unsatisfied forward or external declaration: 'TMainForm.IdFTP1Status' [Error] mainf.pas(77): Unsatisfied forward or external declaration: 'TMainForm.TraceCheckBoxClick' [Error] mainf.pas(78): Unsatisfied forward or external declaration: 'TMainForm.FormCreate' [Error] mainf.pas(79): Unsatisfied forward or external declaration: 'TMainForm.DirectoryListBoxClick' [Error] mainf.pas(80): Unsatisfied forward or external declaration: 'TMainForm.IdFTP1Work' [Error] mainf.pas(82): Unsatisfied forward or external declaration: 'TMainForm.IdFTP1WorkBegin' [Error] mainf.pas(84): Unsatisfied forward or external declaration: 'TMainForm.IdFTP1WorkEnd' [Error] mainf.pas(85): Unsatisfied forward or external declaration: 'TMainForm.UsePassiveClick' [Error] mainf.pas(86): Unsatisfied forward or external declaration: 'TMainForm.ChDirButtonClick' [Error] mainf.pas(87): Unsatisfied forward or external declaration: 'TMainForm.CreateDirButtonClick' [Hint] mainf.pas(90): Private symbol 'AbortTransfer' declared but never used [Hint] mainf.pas(92): Private symbol 'BytesToTransfer' declared but never used [Hint] mainf.pas(93): Private symbol 'STime' declared but never used [Error] mainf.pas(94): Unsatisfied forward or external declaration: 'TMainForm.ChageDir' [Error] mainf.pas(96): Unsatisfied forward or external declaration: 'TMainForm.SaveFTPHostInfo' [Hint] mainf.pas(97): Private symbol 'GetHostInfo' declared but never used [Fatal Error] s7aticftp.dpr(19): Could not compile used unit 'mainf.pas'
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.