Base64 decoding error in coldfusion -


i'm trying decode base64 string #tostring( tobinary( stringtodecode ) )# , coldfusion gives error saying parameter must base-64 encoded string. string comes third party, , supposed pdf file. here part of it:

jvberi0xljukjeljz9mkmsawig9iago8pc9uexbll1hpymply3qvumvzb3vyy2vzpdw+pi9tdwj0 exbll0zvcm0vqkjvefswidagmtuundqgmtuundzdl01hdhjpecbbmsawidagmsawidbdl0xlbmd0 acaymi9gb3jtvhlwzsaxl0zpbhrlci9gbgf0zurly29kzt4+c3ryzwftck9lhxbaedxzpio1a/gj mguxqdw3qkgkzw5kc3ryzwftcmvuzg9iagoyidagb2jqcjw8l1r5cguvwe9iamvjdc9szxnvdxjj zxm8pd4+l1n1ynr5cguvrm9ybs9cqm94wzagmcaxns40ncaxns4xov0vtwf0cml4ifsxidagmcax idagmf0vtgvuz3roidiyl0zvcm1uexblidevrmlsdgvyl0zsyxrlrgvjb2rlpj5zdhjlyw0ktdn8 nkukyx04gj8v9lfobogvn9vrigplbmrzdhjlyw0kzw5kb2jqcjmgmcbvymokpdwvvhlwzs9yt2jq zwn0l1jlc291cmnlczw8pj4vu3vidhlwzs9gb3jtl0jcb3hbmcawide1ljq0ide1ljcyxs9nyxry axggwzegmcawidegmcawxs9mzw5ndgggmjivrm9ybvr5cgugms9gawx0zxivrmxhdgvezwnvzgu+  

what had thought spaces problem, did replace replace " " "" , still in there. there else should doing?

in testing can take local pdf , convert string mimic string getting api. can take , convert pdf.

when use string put above cannot work. not sure if list pasting here or not.

here code, maybe can alter use string right api.

<cffile action="readbinary" file="#expandpath('./test.pdf')#" variable="thefile"/>  <cfset the_string = tostring(thefile)/>  <cfscript> patrick_string = tobase64("jvberi0xljukjeljz9mkmsawig9iago8pc9uexbll1hpymply3qvumvzb3vyy2vzpdw+pi9tdwj0 exbll0zvcm0vqkjvefswidagmtuundqgmtuundzdl01hdhjpecbbmsawidagmsawidbdl0xlbmd0 acaymi9gb3jtvhlwzsaxl0zpbhrlci9gbgf0zurly29kzt4+c3ryzwftck9lhxbaedxzpio1a/gj mguxqdw3qkgkzw5kc3ryzwftcmvuzg9iagoyidagb2jqcjw8l1r5cguvwe9iamvjdc9szxnvdxjj zxm8pd4+l1n1ynr5cguvrm9ybs9cqm94wzagmcaxns40ncaxns4xov0vtwf0cml4ifsxidagmcax idagmf0vtgvuz3roidiyl0zvcm1uexblidevrmlsdgvyl0zsyxrlrgvjb2rlpj5zdhjlyw0ktdn8 nkukyx04gj8v9lfobogvn9vrigplbmrzdhjlyw0kzw5kb2jqcjmgmcbvymokpdwvvhlwzs9yt2jq zwn0l1jlc291cmnlczw8pj4vu3vidhlwzs9gb3jtl0jcb3hbmcawide1ljq0ide1ljcyxs9nyxry axggwzegmcawidegmcawxs9mzw5ndgggmjivrm9ybvr5cgugms9gawx0zxivrmxhdgvezwnvzgu+");  string2 = tobinary(tobase64(the_string));  binencode=binaryencode(string2, "base64");   </cfscript>   <cffile action="write" file="#expandpath('./randy.pdf')#" output="#thefile#" addnewline="no" />  <a href="randy.pdf">click</a> 

updated code:

<cffile action="readbinary" file="#expandpath('./test.pdf')#" variable="thefile"/>  <cfset the_string = tobase64(thefile)/>  <cfscript>  string2 = tobinary(the_string);  </cfscript>   <cffile action="write" file="#expandpath('./randy.pdf')#" output="#string2#" addnewline="no" />  <a href="randy.pdf">click</a> 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -