Question
· Aug 14, 2019

upload file to FTP

Hi

I am trying to upload a file to a ftp site using following code.
Problem is file is getting upload but there is no data. Can you plz advise where I am getting lost.
Also my files are with big data, 2+ GB, as far as know this ftp upload will not effect on my cache.dat size. Plz correct if my understanding is not correct.

Set ftp = ##class(%Net.FtpSession).%New()
set sc = ftp.Connect("myFtpServer","myUserID","myPswd")
Set filestream = ##class(%Library.FileCharacterStream).%New()
Set sc = filestream.LinkToFile("\Temp\GaganTest")
set newname = "PrintWaitDetail-14936.xls"
Set sc = ftp.Store(newname,filestream)
Write "Length of file received: ",filestream.Size,!
If 'ftp.Logout() Write "Failed to logout",!

Regards

Gagan

Discussion (3)1
Log in or sign up to continue

Are you pointing the filestream to the correct file : is there any data in the filestream (you are using \Temp\GaganTest : it will use the same drive as the one where your database is located, also no extension is mentioned)

You can set a timeout (Set ftp.Timeout = 100) if the ftp server times out when uploading big files.

The file size will not effect your cache.dat size.