I have a project containing a JSP page. I want him to have a file upload form that she needs to submit to an API that will process it. I upload it through
<form action="api/processExcel" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
when I delete enctype="multipart/form-data", it works fine, but as soon as I put it there and recompiled and started the project, this error appears:
Invalid CSRF Token 'null' was found on the
request parameter '_csrf' or header 'X-CSRF-TOKEN'.
I also need to know the file upload location. Is there a default place where it is loaded, or do we need to specify it?
When i do it
` try {
http
.csrf().disable();
}`
and disable csrf, it starts working fine.
source
share