문제

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.

올바른 솔루션이 없습니다

다른 팁

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top