Platforms to show: All Mac Windows Linux Cross-Platform

/Main/Web Edition Examples/Invisible FileUploader with Button Web1
Function:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Web Edition Examples/Invisible FileUploader with Button Web1
This example is the version from Tue, 11th Jul 2016.
Project "Invisible FileUploader with Button Web1.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 FileUploader1 Inherits WebFileUploader
ControlInstance FileUploader1 Inherits WebFileUploader
EventHandler Sub UploadBegin(FileCount As Integer) listbox1.DeleteAllRows ListBox1.AddRow "Upload "+str(FileCount)+" files." End EventHandler
EventHandler Sub UploadComplete(Files() As WebUploadedFile) for each file as WebUploadedFile in files listbox1.AddRow file.Name next End EventHandler
End Control
Control Button1 Inherits WebButton
ControlInstance Button1 Inherits WebButton
End Control
Control Button3 Inherits WebButton
ControlInstance Button3 Inherits WebButton
EventHandler Sub Action() FileUploader1.Upload End EventHandler
End Control
Control ListBox1 Inherits WebListBox
ControlInstance ListBox1 Inherits WebListBox
End Control
Control Label1 Inherits WebLabel
ControlInstance Label1 Inherits WebLabel
End Control
EventHandler Sub Shown() // connect + from FileUploader1 to Button1 dim js as string const mimetype = "image/jpeg" // other mime types: // text/* for all text files // image/* for all image files // .ext for an extension js = "document.getElementById('"+FileUploader1.ControlID+"_form').appendChild(document.getElementById('"+Button1.ControlID+"'));"+_ "var chooser=document.getElementById('"+FileUploader1.ControlID+"_form').getElementsByClassName('chooser')[0];" +_ "var input = chooser.getElementsByTagName('input')[0];"+_ "input.accept='"+mimetype+"';"+_ "chooser.style.cssText = 'position: absolute; left: 0px; bottom: 0px; width: "+str(button1.Width)+"px; height: "+str(button1.Height)+"px; overflow: hidden;';"+_ "input.style.cssText = 'position: absolute; left: 0px; bottom: 0px; background-color: #FFFFFF;opacity: 0;filter: alpha(opacity=0);width: 100%;height: 100%;';"+_ "document.getElementById('"+Button1.ControlID+"').appendChild(input);" ExecuteJavaScript js End EventHandler
End Class
End Project

See also:

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

Feedback: Report problem or ask question.

The biggest plugin in space...