You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/FTP/CURLS ftp file upload direct
Class Window1 Inherits Window
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
DoUpload
End EventHandler
End Control
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
Control URL Inherits TextField
ControlInstance URL Inherits TextField
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Private Sub DoUpload()
dim f as FolderItem = GetOpenFolderItem("all")
if f = nil then Return
dim d as new UploadCURL
if d.OpenMTInputFile(f) then
// ok
else
MsgBox "Failed to open file."
Return
end if
d.OptionURL=url.text
d.OptionUpload=true
d.OptionVerbose = true // generate messages
d.CollectDebugMessages = true // collect them
d.OptionUsername = "test"
d.OptionPassword = "xxxx"
d.OptionSSHAuthTypes = 2+8 // for SFTP: only allow keyboard or interactive login, no public key
dim e as integer = d.Perform
dim DebugMessages as string = d.DebugMessages
// check those in debugger in case of errors
listbox1.addrow "Result: "+str(e)
if e <> 0 then
break
end if
End Sub
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu5 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = ""
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = ""
End MenuBar
Class App Inherits Application
End Class
Class UploadCURL Inherits CURLSMBS
EventHandler Function Progress(dltotal as Int64, dlnow as Int64, ultotal as Int64, ulnow as Int64, percent as double) As boolean
if ultotal=0 then
window1.listbox1.addrow "Uploading..."
else
window1.listbox1.addrow "Uploading "+Format(ulnow/ultotal,"-0%")+" "+stR(ulnow)+" of "+str(ultotal)
end if
End EventHandler
End Class