0

I am uploading a file. The jsp has the following.

 <form id="uploadRepoData" enctype="multipart/form-data">
  <input style="width: 250px" type="file" name="loadfile" class="loadInputDisplay"/> 

On clicking the submit button, the csrf token is appended to the form and a post request is done. However, the request seems to have a null csrf token, hence the request is thought to be an invalid request and it fails.

I am not sure how to fix this.

Mary
  • 1,505
  • 5
  • 27
  • 44

2 Answers2

1

By appending the csrf token as a query parameter to the action fixed it

Mary
  • 1,505
  • 5
  • 27
  • 44
-2

Append csfr in your form action......

<s:form  action="${pageContext.request.contextPath}/admin/marketinfo/bulkupload?${_csrf.parameterName}=${_csrf.token}" 
   enctype="multipart/form-data" modelAttribute="upload" method="POST" 
   class="form-horizontal" role="form">
Jérémie B
  • 10,611
  • 1
  • 26
  • 43
Piyush
  • 1