Here is an example of how it works:
$.ajaxFileUpload(
{
url: 'MyHandler.ashx?filename=test.png&path=../test/Images',
secureuri: false,
fileElementId: 'fileToUpload',
dataType: 'json',
data: { name: 'john', id: '123' },
success: function(data, status) {
if (typeof (data.error) != 'undefined') {
if (data.error != '') {
alert(data.error);
} else {
alert(data.msg);
}
}
},
error: function(data, status, e) {
alert(e);
}
})
Within the Generic Handler:
public void ProcessRequest(HttpContext context)
{
string fileName = (string)context.Request["filename"];
}
Alternative Solution
var filename = "test.png";
$.ajaxFileUpload(
{
url: 'MyHandler.ashx?filename=test.png&path=../test/Images',
secureuri: false,
fileElementId: 'fileToUpload',
dataType: 'json',
data: { name: 'john', id: '123', filename: filename },
success: function(data, status) {
if (typeof (data.error) != 'undefined') {
if (data.error != '') {
alert(data.error);
} else {
alert(data.msg);
}
}
},
error: function(data, status, e) {
alert(e);
}
})