Page 2 of 2

Image Upload

Posted: Thu Oct 27, 2016 9:13 am
by Amirul Momenin

http://jsfiddle.net/JHQnk/1659/

How will I run this into Appery


Image Upload

Posted: Fri Oct 28, 2016 6:04 am
by Logan

Hi Amirul Momenin.

You can use that code wherever you want.

E.g If you want to use that code on some button's "onclick" event then you can write that code in "runjavascript" action of that button.

Logan.


Image Upload

Posted: Fri Oct 28, 2016 11:44 am
by Amirul Momenin

Not working
can you check this
var handleFileSelect = function(evt) {

Code: Select all

alert(1) 

 var files = evt.target.files; 
 var file = files[0]; 

 if (files && file) { 
     var reader = new FileReader(); 

     reader.onload = function(readerEvt) { 
         var binaryString = readerEvt.target.result; 
   data = 'data:'+file.type+';base64,'+ btoa(binaryString); 
   document.getElementById("base64textarea").value = data; 
    document.getElementById("image").src = data;  

     }; 

     reader.readAsBinaryString(file); 
 } 

};

if (window.File && window.FileReader && window.FileList && window.Blob) {
document.getElementById('filePicker').addEventListener('change', handleFileSelect, false);
} else {
alert('The File APIs are not fully supported in this browser.');
}


Image Upload

Posted: Fri Oct 28, 2016 11:51 am
by Amirul Momenin

I need just binary data of file
You can show any other example

Image

pls look the screnshoot


Image Upload

Posted: Fri Oct 28, 2016 11:54 am
by Logan

Send me some screenshots of how you wrote that code and where?


Image Upload

Posted: Sat Oct 29, 2016 3:17 am
by Amirul Momenin

How will I pass event?
This is main problem


Image Upload

Posted: Sat Oct 29, 2016 3:31 am
by Amirul Momenin

Image

Ok finally I solve this


Image Upload

Posted: Sat Oct 29, 2016 3:33 am
by Amirul Momenin

Image Upload

Posted: Sat Oct 29, 2016 3:35 am
by Amirul Momenin

var files = event.target.files;
for(i=0;i).src = data;
alert(data)

Code: Select all

 };  
 reader.readAsBinaryString(file);  
 }  

}


Image Upload

Posted: Sat Oct 29, 2016 4:44 am
by Logan

Hi Amirul Momenin.

Thanks for details.

Is there any error in console log or is there any alert that you used for errors?

Logan.