Jump to content
Mark-

FTP transfers...

Recommended Posts

Hello,

 

Using cellular, depending on many factors, I can get many 500 error codes that abort the transfer.

I am using FtpClient.Transmit; with binary, passive.

 

What is the correct way to "resume" the transfer?

 

Thanks,

Mark

Edited by Mark-

Share this post


Link to post

The correct way to resume FTP is to use the new TIcsFtpMulti component in OverbyteIcsFtpMulti.pas, with a demo in OverbyteIcsXferTst.dpr, it will automatically repeat failed transfers using resume if possible.  There is a function to FTP a single file if you don't want it to automatically upload or download a nested directory structure.

 

Angus

 

Share this post


Link to post

Thanks Angus, François and all the contributors.

 

Using the example, I was able to replace the TFtpClient with TIcsFtpMulti and watch the FTP resume when the transfer failed from the server returning an error or loss of connection. I used the single file, FtpUpOneFile function.

 

Cheers,

 

Mark

Share this post


Link to post

Hello,

 

OK I spoke too soon and I cannot locate my error.

I am using FtpUpOneFile.

The source path is OK

The filename is OK

The target path is '/public_html/downloads/'.

All the files are being placed at the root, '/'.

 

I set the TarDir and SrcDir before calling logon. and the FtpUpOneFile is correct.

I see "fServRootDir" is '/'.

I see PWD and DirResult is '/'.

I see fServBaseDir and fCurRemDir both being set to '/public_html/downloads/'.

 

In IntUpOne , HostDirName := '/' ; Not sure it is relevant.

 

Then Put is called and the file uploads to the root.

 

These are the same paths used before switching to FtpUpOneFile.

 

What am I doing wrong/missing?

 

Thanks,

 

Mark

 

 

Edited by Mark-

Share this post


Link to post

If I call CWD after logon and before FtpUpOneFile, the files upload to the correct paths.

Perhaps I am not setting a property correctly or at all. Or calling CWD first is by design.

 

Share this post


Link to post

I've not used FtpUpOneFile myself for many years, it was written for another client and worked in their circumstance, need to test it.  

 

Angus

Share this post


Link to post

> I've not used FtpUpOneFile myself for many years, it was written for another client and worked in their circumstance, need to test it.

 

Very good.

Edited by Mark-

Share this post


Link to post

Just tested 'Single FTP' upload using the ICS File Transfer Demo and it seems to work correctly.  You should not need to set any component properties for paths, FtpUpOneFile uses the remote path specified there and correctly changes to the specified directory:

 

> PWD
< 257 "/" is current directory.
> CWD /logs/testing/
< 250 CWD command successful. "/logs/testing" is current directory.
> PWD
< 257 "/logs/testing" is current directory.
Uploading File, C:\tempfiles\regnam20.zip to /logs/testing/regnam20.zip, size 238 Kbytes
 

Angus

 

Share this post


Link to post

Thanks.

Without a doubt it does not work here without me calling CWD after logon.

Is CWDAsync used?

I ask because this is testing on cellular.

If I call CWDAsync after logon no change, file is uploaded to root.

If I call CWD, the file is uploaded to the correct path.

Share this post


Link to post

The FTPMulti component only use sync commands.  Sure it will work with extra code to set the correct directory, but that code will be called anyway including creating directories if they don';t exist, with the correct parameters.   Try the sample.

 

Angus

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×