Lets the user pick a file on their computer and copies it into the web file store under its own name, so fileReadFile and the other file functions can read it.
Takes filter (the file types to offer, e.g. ".sav,.txt" ("" for any file)).
Returns: 1 if the file picker opened, 0 if an import is already waiting for the user.
File IO
Parameters & Returns
Parameters
filterString
Returns
Int
Quick Summary
Lets the user pick a file on their computer and copies it into the web file store under its own name, so fileReadFile and the other file functions can read it.
Takes filter (the file types to offer, e.g. ".sav,.txt" ("" for any file)).
Returns: 1 if the file picker opened, 0 if an import is already waiting for the user.
Technical Exegesis...
Lets the user pick a file on their computer and copies it into the web file store under its own name, so fileReadFile and the other file functions can read it. A browser can't wait for the user, so this returns at once: check fileImportWebResult each frame to find out what happened. Call it when the user clicks or presses a key (a button, a menu item): browsers only open a file picker straight after one.
Web target only: on the desktop, programs read and write real files, so they don't need it.
Lets the user pick a file on their computer and copies it into the web file store under its own name, so fileReadFile and the other file functions can read it. A browser can't wait for the user, so this returns at once: check fileImportWebResult each frame to find out what happened. Call it when the user clicks or presses a key (a button, a menu item): browsers only open a file picker straight after one.
Web target only: on the desktop, programs read and write real files, so they don't need it. See Building for the Web (File System). GUI programs using BGI can use bgiExportFileWeb / bgiImportFileWeb instead, which answer with a BGI event.
Returns: 1 if the file picker opened, 0 if an import is already waiting for the user.
Example
Example.bam
If igiButton("Load...") Then fileImportWeb(".sav")
; every frame:Local name:String = fileImportWebResult()
If name <> "" And name <> "*cancelled*" Then LoadGame(name)