Hi, this is something that I simply can't do due to my (less than) minimal
knowledge of Javascript.
The idea is that, since emscripten programs can't acess the local file
system, maybe we can add, through a custom shell (= html file), a button
(or some kind of drag and drop area) where the user can pass a file of his
local file system.
Then, that file is read by Javascript and turned into a char array and then
a method is called from Javascript into C++ that can read it.
Is this approach viable ?
This is the html code I've found so far:
<!DOCTYPE HTML>
>
<html>
>
<head>
>
</head>
>
<body>
>
<!--multiple is set to allow multiple files to be selected-->
<input id="myfiles" multiple type="file">
>
<div id="your-files"></div>
>
</body>
>
<script>
>
var pullfiles=function(){
>
// love the query selector
>
var fileInput = document.querySelector("#myfiles");
>
var files = fileInput.files;
>
// cache files.length
>
var fl=files.length;
>
var i=0;
>
while ( i < fl) {
// localize file var in the loop
>
var file = files[i];
>
alert(file.name); // Here we should read the file and pass it to
> emscripten
>
i++;
>
}
>
}
>
// set the input element onchange to call pullfiles
>
document.querySelector("#myfiles").onchange=pullfiles;
>
</script>
>
</html>
>
Can somebody help me to fill the
gaps ?
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.