All,
I ran into a strange problem. I’m iterating through all files in a folder and for every file I bump into, I upload it to FTP.
Works fine for all files, but the last one is always 0 bytes on the server. I spent all morning trying to understand why this happens on the last file…
Could someone help me understand this?
thanks
gert
Dim JobFolder As FolderItem
JobFolder = New FolderItem(XojoIOjobFolder.Path, FolderItem.PathTypeNative)
dim d2 as new UploadCURL
d2.OptionUsername = "123"
d2.OptionPassword = "xyz"
d2.CollectDebugData = true
d2.OptionVerbose = true
d2.OptionFTPPort="21"
d2.OptionUpload=true
dim e as integer
For i As Integer = 1 To JobFolder.Count
d2.OptionURL="sftp://servername.here/dir/"+JobFolder.Item(i).Name
if not d2.OpenMTInputFile(JobFolder.Item(i)) then
MsgBox "Error: " + d2.OptionURL
end if
e=d2.Perform
Select case e
case d2.kError_LOGIN_DENIED
MsgBox "Wrong password."
case d2.kError_UNSUPPORTED_PROTOCOL
MsgBox "Protocol not implemented."
case d2.kError_OK
MsgBox "Upload done: " + JobFolder.Item(i).Name
else
MsgBox "Result: "+str(e)
end select
d2.CloseMTInputFile
Next
Exception oobe As OutOfBoundsException
MsgBox "Error: "+ oobe.Message