Category: BGI GUI (Web target only)
Syntax:
bgiImportFileWeb:Int(filter:String, window:Int)
Int
Lets the user pick a file on their computer and copies it into the web file store.
The browser's own file picker opens. The chosen file is stored under its own name, so bgiLoadRichTextFile, fileReadFile and so on can then read it.
A browser can't wait for the user, so the function returns at once: 1 if the picker opened, 0 if the window doesn't exist. The answer arrives later as an event:
Message BGI_EVENT_COMMAND_CLICK, ID BGI_EVENT_ID_IMPORTFILE, source = window. bgiGetEventData is 1 if a file was imported, or 0 if the user cancelled or the file was too big for the web file store. bgiGetEventExtra is the stored file name.
Call it from a button or menu handler: browsers only open a file picker just after the user clicks or presses a key.
Web target only.
; In WebLoop: the Import button asks for a file...
If eventSource = btnImport Then bgiImportFileWeb(".rtf,.txt", window)
; ...and the answer loads it
If bgiGetEventMessage() = BGI_EVENT_COMMAND_CLICK And bgiGetEventID() = BGI_EVENT_ID_IMPORTFILE Then
If bgiGetEventData() = 1 Then bgiLoadRichTextFile(richTextBox, bgiGetEventExtra())
EndIf
See also: bgiExportFileWeb
BambooBasic © 2026 Michael Denathorn