MBS CURL Plugin

Am Using MBS Curl Plugin for Auto FTP.
If there is no data to transfer application through the “IOE exception error 2”.

Here is my code:

dim folder , Folder1 , item as FolderItem
dim e as integer
dim d as UploadCURL
dim b as BinaryStream
Dim itemIdx As Integer
folder=GetFolderItem(x)

For itemIdx = 1 to folder.Count
item = folder.Item(itemIdx)
If item <> nil Then
Folder1 = GetFolderItem(x+"/"+item.name)
b = BinaryStream.Open(Folder1)
d=new UploadCURL
d.stream=b
d.OptionURL=“sftp://”+FTPHost+item.name
d.OptionUsername = FTPUser
d.OptionPassword = FTPPassword
d.OptionPort = Val(FTPPort)
d.OptionVerbose = true
d.OptionUpload=true
d.OptionInFileSize=b.Length
d.CollectDebugData = true
e=d.Perform
End
Next

Kindly advice how to resolve this

  1. Please do not use GetFolderitem here. Use folder.TrueItem() function!
  2. BinaryStream.Open can raise exception. Watch for it!
  3. You can use OpenMTInputFile to have the plugin read file and stream it. Or read data in Xojo and pass as block.
  4. You should really write somewhere he error code and get the DebugData text with messages.