passing base64 image string in xml tag

I tried this code, but it is not working. Any suggestions or any solutions for above issue for sending base64 string in xml tag.
I have searching lot of about base64 string passing to java server using this xml tags(i.e. xml parsing) but not get any results.

function fileSelectedForLogo() {
    var oFile = document.getElementById('image_file').files[0];
	if(oFile.size/1024 <= 50){
    var oImage = document.getElementById('preview');
    var oReader = new FileReader();
	 oReader.onload = function(e){
        oImage.src = e.target.result;
		var resultStr = oImage.src;
		var result = resultStr.split(",");
		$('#LogoImageKey').val(result[1]);		
		};
		alert($('#LogoImageKey').val())
    oReader.readAsDataURL(oFile);	
	}else{
		alert(" Please Upload Less 50 KB ")
	}	
    }

function creatingXMLRequest(){
      var Name =	$('#Name').val();
      var logoImage		=  $('#LogoImageKey').val();
      alert(logoImage);
      var xml="<Request>" +
               "<Data>" +
               ifValueInsert(Name,"CName")+
               ifValueInsert(logoImage,"LogoImage")+
               "</Data>" +
			"</Request>";
     }

function ifValueInsert(value , tagName)
    {
	alert(value+" == "+tagName)
	if(value!=undefined && value!='' && value!=null)
	{
		return "<"+tagName+">"+value+"</"+tagName+">";
	}
	return "";
    }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<body> 
<input type="hidden" id="LogoImageKey" value="" />
    <label id="lblupload">Image Upload:</label>
    <input id="image_file" type="file" onChange="fileSelectedForLogo();" />
<input type="button" onClick="creatingXMLRequest();" value="Submit" />
  </body>


Source: xml

Leave a Reply