Question

i searched google after how can i send a post to ashx page with both file (for upload) and some post parameters like file's name

the XMLHttpRequest send(...) method accept datafile/string, i need both on the same call

is it possible?

i use ajax to perform this call .

tnx.

No correct solution

OTHER TIPS

Try this:

var xhr = new XMLHttpRequest();
xhr.open('post', url, true);
xhr.setRequestHeader("Content-Type","multipart/form-data");

var formData = new FormData();
formData.append("thefile", file);
formData.append('stringParam',param1);
xhr.send(formData);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top