Variable String does not support an image in base64

1

Good morning I have a library, which generates an image base64 from my JSP , that image sent servlet through a post , when I receive it I do not receive the full character information, maybe the string does not support the string in base64 .

Function from jsp with javascript:

function proceso(){
     var socio  = document.getElementById('socio').value;
     var foto64  = document.getElementById('foto64').value;
     f.action='/APLICACIONES/CL_T_FirmaFoto_Servlet?persona='+socio+'&foto64='+foto64;
     f.submit();
}

Reception in the servlet:

Date fec = new Date(System.currentTimeMillis());
String strCodUsu = session.getAttribute("strCodUsu")== null ? "" : (String)session.getAttribute("strCodUsu");
String strCodFoto = request.getParameter("foto64")!=null?(String)request.getParameter("foto64"):"";
String  strCodigoCliente = request.getParameter("persona")!=null?request.getParameter("persona"):"";

The system has java 6 , maybe it does not support that base64 string, I just read that the string supports up to 2gb

Here I send the image string in base64 and the amount that arrives in my string, I hope you can appreciate it

Here the number of characters that reach my servlet

    
asked by Luis Alexander Manrique Lopez 03.05.2018 в 23:26
source

2 answers

0

Depending on the server and its configuration, the maximum supported length of the URL may vary. In Tomcat that value is usually around 8000 characters, so an image that occupies more than 8KB can not be sent as a parameter in the URL.

In any case, if you are doing a POST, the logical and usual thing is to use the body of the request to send the information.

    
answered by 11.05.2018 / 18:58
source
0

"Are you sure you are using POST instead of GET? Please note that not all characters are interpreted correctly in a URL, be sure to pass the representation base64 of the image by POST" Don Klaimmore, check and my code and send the image by post correctly thanks for the help I'm just a student.

    
answered by 11.05.2018 в 18:44