Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/FTP/CURLS ftp directory listing with Web Edition


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 directory listing with Web Edition

This example is the version from Sun, 5th Nov 2022.

Project "CURLS ftp directory listing with Web Edition.xojo_binary_project"
Class App Inherits WebApplication
End Class
Class Session Inherits WebSession
Const ErrorDialogCancel = "Do Not Send"
Const ErrorDialogMessage = "This application has encountered an error and cannot continue."
Const ErrorDialogQuestion = "Please describe what you were doing right before the error occurred:"
Const ErrorDialogSubmit = "Send"
Const ErrorThankYou = "Thank You"
Const ErrorThankYouMessage = "Your feedback helps us make improvements."
Const NoJavascriptInstructions = "To turn Javascript on, please refer to your browser settings window."
Const NoJavascriptMessage = "Javascript must be enabled to access this page."
End Class
Class WebPage1 Inherits WebPage
Control Label1 Inherits WebLabel
ControlInstance Label1 Inherits WebLabel
End Control
Control url Inherits WebTextField
ControlInstance url Inherits WebTextField
End Control
Control Button1 Inherits WebButton
ControlInstance Button1 Inherits WebButton
EventHandler Sub Pressed() MySession = Session MyThread.run End EventHandler
End Control
Control resulttext Inherits WebLabel
ControlInstance resulttext Inherits WebLabel
End Control
Control TextArea1 Inherits WebTextArea
ControlInstance TextArea1 Inherits WebTextArea
End Control
Control MyThread Inherits Thread
ControlInstance MyThread Inherits Thread
EventHandler Sub Run() Dim ws As New WebSessionContext(MySession) MySession = nil dim s as string dim e as integer dim d as new DownloadCURL d.OptionURL=url.Text d.OptionUsername = "test" d.OptionPassword = "password" Break // change credentials d.CollectOutputData = True if CheckBox1.Value then dim p as integer = instr(7, url.Text, "/") dim path as string = mid(url.text, p) d.OptionCustomRequest = "LIST "+path else d.optionDirListOnly=true end if d.w = self e=d.Perform // get output and show it. Maybe fix encoding s = d.OutputData if s.Encoding = nil then if encodings.UTF8.IsValidData(s) then s = DefineEncoding(s, encodings.UTF8) else s = DefineEncoding(s, encodings.ISOLatin1) end if end if s = ReplaceLineEndings(s, EndOfLine) TextArea1.text=s select case e case 9 s=" = CURLE_FTP_ACCESS_DENIED" case 67 s=" = CURLE_LOGIN_DENIED" else s="" end select ResultText.text="Result: "+str(e)+s End EventHandler
End Control
Control CheckBox1 Inherits WebCheckBox
ControlInstance CheckBox1 Inherits WebCheckBox
End Control
Property MySession As Session
End Class
Class DownloadCURL Inherits CURLSMBS
EventHandler Function Progress(dltotal as Int64, dlnow as Int64, ultotal as Int64, ulnow as Int64, percent as double) As boolean if dltotal=0 then w.resulttext.text="Downloading..." else w.resulttext.text="Downloading "+Format(dlnow/dltotal,"0%") end if Return false End EventHandler
Property w As WebPage1
End Class
Sign
End Sign
End Project

See also:

The items on this page are in the following plugins: MBS CURL Plugin.


The biggest plugin in space...