$scope.InsertRecord = function () { var filedata; var f = document.getElementById('file').files[0], r = new FileReader(); alert(f.length); r.onloadend = function (e) { filedata = e.target.result; //console.log(filedata.length) $.ajax({ type: "POST", url: "service.asmx/insertMethod", data: "{'title':'" + $scope.news_title + "','desc':'" + $scope.news_content + "' , 'Img':'" + filedata + "'}", contentType: "application/json; charset=utf-8", //dataType: "application/json", success: function (msg) { alert("Inserting Done"); }, error: function (xhr,status,error) { alert("ERROR MESSAGE :" + error); } }); ResetValues(); } r.readAsDataURL(f);
<img src="jsonResponse.imageUrl" alt="Fetched image" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)