[英]Passing base64 byte array of image in json to webApi
I have converted the image that I upload through jQuery into base64 byte array/String. 我已将通过jQuery上传的图像转换为base64字节数组/字符串。
With the help of code : 借助代码:
function readImage(input) {
debugger;
if (input.files && input.files[0]) {
var FR = new FileReader();
var a = null;
FR.onload = function (e) {
array = e.target.result;
};
FR.readAsDataURL(input.files[0]);
}
I am now passing the array through json to my web Api and having problem. 我现在将数组通过json传递到我的Web Api并遇到问题。
My json call is like: 我的json呼叫就像:
$.getJSON('api/TestImage' + '/' + JSON.stringify(array))
.done(function (data) {
//doSomething
});
My action is : 我的动作是:
public IHttpActionResult TestImage(String id)
{
return Ok(id);
}
So can any one tell what is the problem and what need to be done. 因此,任何人都可以说出问题所在以及需要做什么。
Thanks in advance.. 提前致谢..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.