62
rated 0 times
[
67]
[
5]
/ answers: 1 / hits: 21627
/ 11 Years ago, wed, june 5, 2013, 12:00:00
forgive me if this question is too silly or already asked I googled a lot but I didnt get anything I want. I need to pass a byte array to server side using ajax but its not working as planned my current code is given below
var bytes = [];
for (var i = 0; i < data.length; ++i) {
bytes.push(data.charCodeAt(i));
}
$.ajax({
url: '/Home/ImageUpload',
dataType: 'json',
type: 'POST',
data:{ data:bytes},
success: function (response) {
alert(hi);
}
});
Upload Method
[HttpPost]
public ActionResult ImageUpload(byte[] data)
{
ImageModel newImage = new ImageModel();
ImageDL addImage = new ImageDL();
newImage.ImageData = data;
addImage.AddImage(newImage);
return Json(new { success = true });
}
I know something wrong with my program but I cant find it please help me to solve this
More From » ajax