function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hseth-frondeHseth-fronde 

Base 64 data from visualforce to Controller

Hi, 

 

I am generating bar codes on my visualforce page using jquery library. I am able to get the base 64 object of the image using canvas but now I am stuck on how to post it to controller so that I could attach it to the current record. The problem is I am not able to post blob data from visualforce to apex. 

 

I tried couple of thngs 

1. Assing the entire blob data to a hidden variable and then posting but it gives an error . 

2.  I also tried to use the apex:inputfile tab but its value attribute cannot be written using javascript hence even that is not helping as well. 

 

Can someone help me in finding a way on how can I post Base 64 data from visualforce to Apex controller. 

Best Answer chosen by Admin (Salesforce Developers) 
Hseth-frondeHseth-fronde

Checout my blog, i could resolve the issue and achieve the desired result. 

 

http://himanshooseth1.blogspot.co.nz/2013/12/posting-base-64-data-in-visualforce.html

All Answers

Avidev9Avidev9
You can consider visualforce Remoting for the same. I guess that will provide you with a clean way to send base64 encoded string to controller
Hseth-frondeHseth-fronde

Checout my blog, i could resolve the issue and achieve the desired result. 

 

http://himanshooseth1.blogspot.co.nz/2013/12/posting-base-64-data-in-visualforce.html

This was selected as the best answer