This is a workaround because normal file access in SpiderBasic gives me an error (on Android App), maybe by system limitation.
Comes from this thread: viewtopic.php?t=2640
Feel free to modify and use it as you want

Code: Select all
; Snippet to read file on Android App and Web App (iOS untested)
Procedure OpenRequester()
Protected result.s=""
EnableJS
function LoadArchive(callback) {
var inputFile = document.createElement('input');
inputFile.type = 'file';
inputFile.style.display = 'none';
document.body.appendChild(inputFile);
inputFile.addEventListener('change', function(event) {
var File = event.target.files[0];
if (File) {
var lector = new FileReader();
lector.onload = function(e) {
var contenido = e.target.result;
callback(null, contenido);
};
lector.onerror = function(error) {
callback(error, null);
};
lector.readAsText(File);
}
document.body.removeChild(inputFile);
});
inputFile.click();
};
DisableJS
!LoadArchive(function(error, contenido) {
! if (error) {
! v_result="Error loading file";
Debug result
! } else {
! // Here you can process the archive content =========
! v_result=contenido;
Debug result
! }
!});
EndProcedure
OpenWindow(0, 100, 100, 320, 200, "Test Read File",#PB_Window_ScreenCentered)
ButtonGadget(0,80,50,160,100,"Open")
BindGadgetEvent(0, @OpenRequester())