Platforms to show: All Mac Windows Linux Cross-Platform
/CURL/SFTP/CURLS sftp upload console
Required plugins for this example: MBS CURL Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/SFTP/CURLS sftp upload console
This example is the version from Wed, 3rd Jan 2023.
Project "CURLS sftp upload console.xojo_binary_project"
Class App Inherits ConsoleApplication
EventHandler Function Run(args() as String) As Integer
Dim url As String = "sftp://localhost/users/cs/desktop/test.txt"
dim data as string = "Just a little bit text. Have fun!"
DoUpload url, data
End EventHandler
Private Sub DoUpload(URL as string, data as string)
dim e as integer
dim d as new UploadCURL
d.InputData=data
d.OptionURL=URL
d.OptionUpload=true
d.OptionUsername = "test"
d.OptionPassword = "password"
Break // change credentials
e=d.Perform
print "Result: "+str(e)
dim DebugMessage as string = d.DebugMessages
Select case e
case d.kError_LOGIN_DENIED
print "Wrong password."
case d.kError_UNSUPPORTED_PROTOCOL
print "Protocol not implemented."
case d.kError_OK
print "No error."
else
break // some other error
end select
End Sub
End Class
Class UploadCURL Inherits CURLSMBS
EventHandler Sub DebugMessage(infotype as integer, data as string, dataSize as Integer)
print "Debug: "+data
End EventHandler
EventHandler Function Progress(dltotal as Int64, dlnow as Int64, ultotal as Int64, ulnow as Int64, percent as double) As boolean
if ultotal=0 then
print "Uploading..."
else
print "Uploading "+Format(ulnow/ultotal,"-0%")+" "+stR(ulnow)+" of "+str(ultotal)
end if
End EventHandler
End Class
End Project
See also:
The items on this page are in the following plugins: MBS CURL Plugin.