I have an ajax post that posts some values from url
var sendUrl = url + ',' + testId + ',' +questionId + ',' + questionRevision + ',' + result;
var ajaxData = {
type: "POST",
contentType : 'application/json; charset=utf-8',
dataType : 'json',
data: requestData,
url: sendUrl,
headers: headersData,
};
and bind them with @PathVariable like this:
@RequestMapping(value="/answer,{testId},{qid},{qrev},{qres}", method = RequestMethod.POST)
public @ResponseBody String answer(HttpServletRequest request,
@RequestBody List<NokDataDTO> nokInfoDtos ,
@PathVariable("testId") Long testId,
@PathVariable("qid") Long qid,
@PathVariable("qrev") Integer qrev,
@PathVariable("qres") Integer qres)
With this scenario, is there a way to pass an image file with @PathVariable? I can get the uploaded file from the javascript like this:
var fileVal=document.getElementById("fileLoader").files[0];
but can not find a way to bind it from the RequestMapping.