I am uploading data and image using ashx handler , they are working fine.
But my success function in ajax is not getting executed
See here:
$.ajax({
type: "POST",
url: "../Scripts/uploadify/UploadHandler.ashx",
contentType: false,
processData: false,
data: imag,
success: function(data){
console.log(data.bb);
alert('hii');
}
});
Ashx:
public void ProcessRequest(HttpContext context)
{
HttpPostedFile PostedFile = context.Request.Files[0];
if (!(PostedFile == null))
{
|
|
}
context.Response.ContentType = "application/json";
string bb = PostedFile.FileName;
context.Response.Write(bb); //im getting bb name correctly suppose 'koyla.jpg'
context.Response.StatusCode = 200;
}
public bool IsReusable
{
get
{
return false;
}
}
Im not getting bb in success function , alert is not even executing..???
Update:
var fileUpload = $("#image").get(0);
var files = fileUpload.files;
var imag = new FormData();
for (var i = 0; i < files.length; i++) {
imag.append(files[i].name, files[i]);
imag.append('Data',JSON.stringify({ objEnt: args }));
}