Platforms to show: All Mac Windows Linux Cross-Platform
/CURL/FTP/CURLS ftp download to desktop
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/FTP/CURLS ftp download to desktop
This example is the version from Wed, 14th Jul 2015.
Project "CURLS ftp download to desktop.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class MainWindow Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim url as string = Self.url.text
dim parts() as string = split(url, "/")
dim name as string = parts(UBound(parts))
dim DestinationFile as FolderItem = SpecialFolder.Desktop.Child(name)
DoDownload url, DestinationFile
End EventHandler
End Control
Control URL Inherits TextField
ControlInstance URL Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control ResultText Inherits Label
ControlInstance ResultText Inherits Label
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Private Sub DoDownload(URL as string, dest as FolderItem)
d = new CURLSMBS
if not d.CreateMTOutputFile(dest) then
MsgBox "Failed to create file."
Return
end if
d.OptionURL = URL
// optional with credentials
'd.OptionUsername = "xxx"
'd.OptionPassword = "xxx"
// timeouts
'd.OptionConnectionTimeout = 10
'd.OptionTimeOut = 60
// more flags
d.OptionVerbose = true
d.OptionSSLVerifyHost = 0
d.OptionSSLVerifyPeer = 0
Result = d.PerformMT
d.CloseMTOutputFile
// show result
dim s as string = d.OutputData
if s.Encoding = nil then
s = DefineEncoding(s, encodings.ISOLatin1)
end if
s = ReplaceLineEndings(s, EndOfLine)
TextArea1.text = s
ResultText.text = "Result: "+str(result)
d = nil
End Sub
Property Private DestinationFile As FolderItem
Property Result As Integer
Property Private d As CURLSMBS
Property Private done As Boolean
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
- /CURL/FTP/CURLS ftp create or folder delete
- /CURL/FTP/CURLS ftp directory listing with CURLFileInfoMBS
- /CURL/FTP/CURLS ftp directory listing with Web Edition
- /CURL/FTP/CURLS ftp directory listing with wildcard
- /CURL/FTP/CURLS ftp file upload
- /CURL/FTP/CURLS ftp file upload resume
- /CURL/FTP/CURLS ftp file upload with progress
- /CURL/FTP/CURLS ftp file upload with thread
- /CURL/FTP/CURLS ftp secure upload
- /CURL/FTP/CURLS ftp upload
The items on this page are in the following plugins: MBS CURL Plugin.