Using client.UploadFile changes text file

J Trahair

Well-known member
Joined
May 14, 2008
Messages
175
Location
Spain
Programming Experience
10+
Hi. I am using the following code to upload a file from the desktop to an ftp site. On downloading the same file from the ftp site, I find the file has extra line feeds that weren't in the uploaded file.

VB.NET:
client.UploadFile("ftp://myfiles.myftp.net.uk/www.mydomain.co.uk/httpdocs/FolderName/" & strThisFileNameOnly, strThisFilePathAndName)
where strThisFileNameOnly is (for example) "MyTextFile.csv", and strThisFilePathAndName = "C:\MyFolder\MyTextFile.csv".

The file contents when it is uploaded:
T,02/10/2014 17:13:27,,PTX7545,1234,30,1,6,04CC1759E42584,418,-7,1,x
T,02/10/2014 17:13:38,,PTX7545,1234,30,1,4,04E2D551E42580,50,-5,1,x
T,02/10/2014 17:13:47,,PTX7545,1234,30,1,6,04CC1759E42584,411,-7,1,x
T,02/10/2014 17:13:56,,PTX7545,1234,30,1,4,04E2D551E42580,45,-5,1,x
T,02/10/2014 17:14:06,,PTX7545,1234,30,1,6,04CC1759E42584,404,-7,1,x
the file contents after upload and subsequent download are:
T,02/10/2014 17:13:27,,PTX7545,1234,30,1,6,04CC1759E42584,418,-7,1,x

T,02/10/2014 17:13:38,,PTX7545,1234,30,1,4,04E2D551E42580,50,-5,1,x

T,02/10/2014 17:13:47,,PTX7545,1234,30,1,6,04CC1759E42584,411,-7,1,x

T,02/10/2014 17:13:56,,PTX7545,1234,30,1,4,04E2D551E42580,45,-5,1,x

T,02/10/2014 17:14:06,,PTX7545,1234,30,1,6,04CC1759E42584,404,-7,1,x

Any ideas how I can remove the unwanted line spacing, preferably by another command in the 'client' code line. Of course, I can read the file, replace a double vbCrLf with a single one, then rewrite the file, but that is a bad fudge (IMO).
Thank you.
 
I should add that the manual method I use to download the uploaded file does not introduce the unwanted line feeds.
 
Back
Top