Storing variables from parsed text file using javascript -


the text file contains information want use website logging in purposes

text file contains following..line line

user:password user2:user2password

i have tried using blob read text file variables not getting stored know going wrong or if able read file using method

function readfile(){     var filename = txtname.value;     file = login.txt;     var blob = file.read();     var readtext = blob.text;     var lines = data.split("\n && : " );         //adding file content label placed     lblfilecontent.settext(readtext);     ti.api.info(readtext);     // dispose of file handle & blob.     file = null;     blob = null; } 

i've used in past read txt-file:

javascript (jquery):

function readfile() {     $.post('path/to/php/read_file.php', {         dir: 'path/to/file',         file: 'file_name.txt',     },function(file_contents) {         if (file_contents != '') {             //your code here         }     }); } 

php:

<?php     /* script invoked 'index.html'.      * script gets content of file has been changed       * admin, , uses determine path of file       * set admin.      */     $dir = $_post["dir"];     $file = $_post["file"];     $contents= '';      if ($dhandle = opendir("$dir")) {         while (false !== ($entry = readdir($dhandle))) {             if ($entry != "." && $entry != "..") {                 if ($entry == $file) {                     $entry_path = $dir.directory_separator.$entry;                      $fhandle = fopen($entry_path, 'r');                     $value = fread($fhandle, filesize($entry_path));                     fclose($fhandle);                 }             }         }         closedir($dhandle);          echo "$contents";     } ?> 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -