adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I convert the data from the upload of image into base64?

How can I convert the data from the upload of image into base64?

The data I get from the image is something like this :

�PNG


IHDRjx ?g bKGD������� tIME � $ :� �IDATx���{�UU ǿs gx+(�HA?� ���
�ǧ���4�R�4 �4�|Pi d�35߄�J ,����fb��� bD q����u�s��}���}νw������s������{�v = � p p,P �
� 4 ��W��� O���l�Fp;�5�5m� ���#�{��ߕY գ�� �( �sY��������� �����8 �Ȉ^ � ΫC� ������ 8(�uK ֐�� �ӭ �GYc�B�h� s�{�E��� } PȠ�� /j.�Ϡ���yE� 0 ؽH#��/e;�EE��tX
� ��; #+���}T� ��
�؃ ��IQ=���� 8 � �,- � #�mo3 �� ��s�g�׀Y����� ������ N�}� dz[����0�o�� ��} �n�k� ȦX�E ����q ���
�T�?�g������ Y�-�.u�7WL@�� 8 ����:t �� qW�[ 4#���OU+jc' "�
� q \ �����s�2� ��J9 t� ��@ �m |�ZQÑ :,�2dι ���2\c���oX�� �(���,m�R��zE | x s ځֈ�44 ���)x��7��}V�C��, �Z\ � �2�VG:��pಘ�]�=��,ZIEND�B'�

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I convert the data from the upload of image into base64?

I do not understand the purpose of that link. I'm trying to have in my code the conversion of this type of data into base64. Then save that base64 data into the backend service.

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I convert the data from the upload of image into base64?

These links are not helping at all..
Let me try being more specific. I have created a upload page like the one in this link http://docs.appery.io/tutorials/uploa... but i did not add file create service. I am just trying to save the Image data from the file content which is in the text area component into the backend service, but before I send the image data to the backend service I would like for the data to be shown as a Image in the Image component. How can I do this???

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How can I convert the data from the upload of image into base64?

You don't need to convert it manually when select the file.

But if you realy want to convert some asset to base64 please take a look here: http://stackoverflow.com/questions/24...

For your goals please use "readAsDataURL" reader function instead of "readAsText".

pre
var reader = new FileReader();
reader.onloadend = function(e) {

Code: Select all

     //Getting base64 string 
     var base64String = e.target.result; 

     //Setting base64 as asset for image. 
     Appery("image_result").attr("src", base64String); 
 }; 
 //You are using this function. Comment it. 
 //reader.readAsText(file); 

 //Use this one. 
 reader.readAsDataURL(file); 

/pre

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I convert the data from the upload of image into base64?

Thank you, so much for helping me instead of sending a link with no direction.

THANK YOU!

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I convert the data from the upload of image into base64?

I was following this example http://docs.appery.io/tutorials/uploa... . When I click the "Select File to Upload" button in the browser the choose files opens to upload a file, but on device it doesn't work. Do you know how to fix this so it works on device? It works on browser but not on device.

adam griffin
Posts: 0
Joined: Tue May 21, 2013 8:44 pm

How can I convert the data from the upload of image into base64?

I was following this example http://docs.appery.io/tutorials/uploa... . When I click the "Select File to Upload" button in the browser the choose files opens to upload a file, but on device it doesn't work. Do you know how to fix this so it works on device? It works on browser but not on device.

Return to “Issues”