c# - Send post data with file upload AJAX -
i sending file via ajax this:
var fd = new formdata(); //do stuff adds files var xhr = new xmlhttprequest(); xhr.open('post', '/upload/' + id); xhr.send(fd); and using file in contoller like:
httppostedfilebase file = request.files[i]; this works fine want send more information. how can post more variables along file?
use variable name in xhr.send(). xhr.send(var1=fd&var2=anotherdata). @ server side create 2 post data handlers, namely var1 & var2. 1 hold fd , other hold data.
Comments
Post a Comment