Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Indy FTP Client Upload fortführen (https://www.delphipraxis.net/133717-indy-ftp-client-upload-fortfuehren.html)

Mondengel 7. Mai 2009 12:40


Indy FTP Client Upload fortführen
 
Hallo alle zusammen :hi:

Nicht gleich schlagen wenn Ihr die Frage albern findet, aber langsam bin ich verzweifelt.

Also ich hab mir mit Hilfe der Indy Komponente einen FTP-Client erstellt. Ich verschicke die Dateien über Put. Nun möchte ich, wenn die Übertragung unterbrochen wurde, den Sendevorgang fortführen... nur ich hab einfach keine Ahnung wie das anstellen soll :glaskugel:

Hab überall schon gesucht und find einfach nichts :wall: . Wäre super wenn ihr mir weiterhelfem könntet :hello:

Mondengel 8. Mai 2009 06:54

Re: Indy FTP Client Upload fortführen
 
Hat den wirklich niemand eine Idee? :cry: Ich würde mein Programm auch etws umstellen.

Klaus01 8. Mai 2009 08:03

Re: Indy FTP Client Upload fortführen
 
Guten Morgen,

wenn Du bei experts-exchange nach unter scrollst
findest Du ein Beispiel.
Ein wenig tiefer findest Du noch einen Hinweis
was Du beachten solltest.

Achja: Suchstichworte idftp put resume

Grüße
Klaus

Mondengel 8. Mai 2009 09:06

Re: Indy FTP Client Upload fortführen
 
Ich hab mir mal die Seite angeschaut ... nur leider kann ich die Antwortennicht lesen und ich will mich dort auch nicht anmelden :spin: .

Ich schau mal unter dem Stichwort das du mir gegeben hats. Wäre trotzdem dankbar für weitere vorschläge :tongue:

Mithrandir 8. Mai 2009 09:11

Re: Indy FTP Client Upload fortführen
 
Zitat:

Zitat von Mondengel
Ich hab mir mal die Seite angeschaut ... nur leider kann ich die Antwortennicht lesen und ich will mich dort auch nicht anmelden :spin: .

Doch, kannst du. Ich hasse diese Seite... :wall: Einfach ganz nach unten scrollen. Dann siehste sie auch... ;)

//Edit
Das geht ja wirklich nicht... :shock: Normalerweise kommen doch unendlich viele Werbebanner, und dann kommen die Antworten? :gruebel:

Klaus01 8. Mai 2009 09:22

Re: Indy FTP Client Upload fortführen
 
Zitat:

Zitat von experts-exchange
Hi there Rogerio,

I don't have much time to test the code in a machine with Delphi, but with Indy10, resume support is built-in.

Check out the Put command, where the 3rd parameter (AApend) is a Boolean value. Set that to True, and it will auto resume *if* the FTP server supports resuming.

So, all you need to do is to do something like:
Delphi-Quellcode:
var
  F: TFileStream;
  DoResume: Boolean;
  iSize: Integer;
begin
  DoResume := False;
  F := TFileStream.Create('Somefile.dat', fmOpenRead or fmShareDenyNone);
  try
    with idFTP1 do
    begin
      // code for connecting to FTP Server goes here...

      iSize := Size('Somefile.dat');
      if (iSize > -1) and (F.Size > iSize) then
      // if the file already exists, and the destination file is smaller, check if we want to resume
        if CanResume
          DoResume := MessageDlg('FTP Server supports Resume. Do you want to resume the previous transfer?',
            mtConfirmation, [mbYes, mbNo], 0) = mrYes;
      Put(F, 'Somefile.dat', DoResume);
    end;
  finally
    F.Free;
  end;
end;
rogerbrito:Hi DragonSlayer.

I have tried that. Using a filename as the first parameter the entire file would be appended no to destination file, and not only the missing part. I also tried using a Stream (as in your example). That worked, but the destination file would always be incomplete (a few kbytes short).

So I've changed to ICS FTPCli component (http://www.overbyte.be) . It's free and I've found a resume upload example that works! I have already implemented it on my application and it is working great!

Thank you for help anyway.

Rogerio


DragonSlayer:Hi Rogerio, I forgot one piece of code... I think you actually need to perform a Seek to the right position in your stream before calling Put. Glad that




Mondengel 8. Mai 2009 10:49

Re: Indy FTP Client Upload fortführen
 
Hey Es hat geklappt :party:

Ich danke euch vielmals für die Hilfe :mrgreen:


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:54 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz