|
@@ -35,31 +35,40 @@ var StandaloneFileBrowserWebGLPlugin = {
|
|
|
this.value = null;
|
|
|
};
|
|
|
fileInput.onchange = function (event) {
|
|
|
- // multiselect works
|
|
|
- var urls = [];
|
|
|
+ // multiselect works
|
|
|
|
|
|
for (var i = 0; i < event.target.files.length; i++) {
|
|
|
//urls.push(URL.createObjectURL(event.target.files[i]));
|
|
|
var reader = new FileReader();
|
|
|
reader.readAsDataURL(event.target.files[i]);
|
|
|
+ var url = URL.createObjectURL(event.target.files[i]);
|
|
|
+ var f_name= event.target.files[i].name;
|
|
|
var base64data;
|
|
|
- reader.onload = function () {
|
|
|
+ reader.onload = function () {
|
|
|
+ var urls = [];
|
|
|
base64data = reader.result;
|
|
|
- console.log(base64data);
|
|
|
+ console.log(base64data);
|
|
|
+ urls.push({
|
|
|
+ "url": url,
|
|
|
+ "file_name": f_name,
|
|
|
+ "base64": base64data
|
|
|
+ });
|
|
|
+ //console.log('js: '+JSON.stringify(urls));
|
|
|
+ SendMessage(gameObjectName, methodName, JSON.stringify(urls));
|
|
|
};
|
|
|
reader.onerror = function (error) {
|
|
|
console.log('Error: ', error);
|
|
|
- base64data= error;
|
|
|
+ //base64data= error;
|
|
|
};
|
|
|
|
|
|
- urls.push({
|
|
|
+ /*urls.push({
|
|
|
"url": URL.createObjectURL(event.target.files[i]),
|
|
|
"file_name": event.target.files[i].name,
|
|
|
"base64": base64data
|
|
|
- });
|
|
|
+ }); */
|
|
|
}
|
|
|
// File selected
|
|
|
- SendMessage(gameObjectName, methodName, JSON.stringify(urls));
|
|
|
+ //SendMessage(gameObjectName, methodName, JSON.stringify(urls));
|
|
|
|
|
|
// Remove after file selected
|
|
|
document.body.removeChild(fileInput);
|