Create a custom REST endpoint that can receive file uploads
Overview
This REST endpoint allows receiving file uploads from an HTML form, that may look like:
<form action="http://jirahost/rest/scriptrunner/latest/custom/fileUpload" method="POST" enctype="multipart/form-data">
<input type="file" name="myfile">
<input type="submit"/>
</form>
The key point here is that the endpoint closure has the signature:
{ MultivaluedMap queryParams, HttpServletRequest request ->
Note the second argument is a HttpServletRequest
, and not a String
.
When we see this we do not attempt to read the request input stream.