Hi
I want to upload *.csv files to a specifik ftp folder and I have found some code, that I do not understand. Can someone help me?
FTPSetup.SETRANGE("FTP Active",TRUE);
IF FTPSetup.FINDSET THEN
REPEAT
URL := FTPSetup."FTP Server" + ' ';
URL += FTPSetup."Path to Files"+'/' + 'de-int2c5-05012021.csv';
FTPRequest := WebRequest.Create(URL);
FTPRequest.Credentials := Credentials.NetworkCredential(FTPSetup."User ID",FTPSetup.Password);
FTPRequest.KeepAlive := FALSE;
FTPRequest.UseBinary := TRUE;
FTPRequest.Method := 'STOR';
FTPRequest.UsePassive := TRUE;
FileStream := FileA.OpenRead(FTPSetup."Path to Files"+'/' + 'de-int2c5-05012021.csv');
FTPRequest.GetRequestStream.Write(FileA.ReadAllBytes(FTPSetup."Path to Files"+'/' + 'de-int2c5-05012021.csv'), 0, FileStream.Length);
UNTIL FTPSetup.NEXT = 0;
Is the above code right to use to FTP upload?
Best Recards
Javaid
0
Answers
This is code that can upload a file to a FTP site:
Thanks. I have some questions.
Mark with green: This is the full path to the file I will upload.
Mark with yellow: What is passive? Can it be false?
I will move the file to the FTP folder Mask_0295. Where do I mention this in the code?
Active and passive:
Yes it can, it depends on the FTP server you can read more about active/passive here: https://www.jscape.com/blog/bid/80512/active-v-s-passive-ftp-simplified
Could you please, tell me what king of variables are those used in this peace of code?
Thank you ever so much
Thanks to everyone.
Thank you ever so much
https://rockwithnav.wordpress.com/2017/08/31/file-upload-ftp/
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!