You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/CURLS query file size
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
DoDownload
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 ResultText2 Inherits Label
ControlInstance ResultText2 Inherits Label
End Control
Private Sub DoDownload()
dim e as integer
dim d as new DownloadCURL
d.OptionNoBody=true
d.OptionURL=url.text
d.CollectOutputData = true
e=d.Perform
ResultText2.text = "Result: "+str(e)+" and we got this file size: "+str(d.FileSize)+" Bytes"
End Sub
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
Class DownloadCURL Inherits CURLSMBS
EventHandler Function Header(data as string) As integer
if left(data,16)="Content-Length: " then
FileSize = val(mid(data,17))
end if
Return lenb(data)
End EventHandler
Property FileSize As Double
End Class