Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/FTP/CURLS ftp file uploads


Required plugins for this example: MBS CURL Plugin, MBS Util Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/FTP/CURLS ftp file uploads

This example is the version from Tue, 16th Sep 2019.

Project "CURLS ftp file uploads.xojo_binary_project"
FileTypes
Filetype text
Filetype all
End FileTypes
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
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 o as new OpenDialogMBS dim d as UploadCURL dim u as string = url.Text if Right(u,1)<>"/" then u = u + "/" end if // select several files o.MultipleSelection = true o.ShowDialog // upload them all dim c as integer = o.FileCount-1 for i as Integer = 0 to c dim f as FolderItem = o.Files(i) Listbox1.AddRow "file: "+f.Name dim b as BinaryStream = BinaryStream.Open(f) d=new UploadCURL d.stream = b d.OptionURL = u + f.Name // change URL to match this file d.OptionUpload = true d.OptionInFileSize = b.Length d.OptionUsername = "test" d.OptionPassword = "xxxx" // run dim e as integer = d.Perform listbox1.addrow "Result: "+str(e) next 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
EventHandler Function Read(count as integer) As string // using stream methods allows us to handle more data than fits in memory Return stream.Read(count) End EventHandler
EventHandler Function RestartRead() As boolean stream.position=0 Return false // no error End EventHandler
Property stream As binaryStream
End Class
End Project

See also:

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


The biggest plugin in space...