Note that there are some explanatory texts on larger screens.

plurals
  1. POMultipart File submit never hit the server method
    primarykey
    data
    text
    <p>I have an ajax call: what happens is that I click on an Image that clicks on "input file" that I don't want it to be shown. when the input val() is changed method <code>uploadListener()</code> is invoked which is basically an ajax method that get the file to the server "upload it to server" code goes like this: html:</p> <pre><code>&lt;img id="${assayAssessRequest.id}" src="[@spring.url '/images/buttons/upload.jpg'/]" onclick="uploadFile(this);" title="Upload File" /&gt; &lt;form id="uploadForm" action="[@spring.url '/assay/designability/uploadFile.htm'/]" method="POST" enctype="multipart/form-data"&gt; &lt;div style="display: none;"&gt; [@spring.formInput path="multiPartBean.file" fieldType="file" attributes="title='path' class='upload' accept='.txt,.csv,.zip'" /] [@spring.formHiddenInput path="multiPartBean.fileName" attributes=" onchange='uploadListener();'class='uploadFileName'" /] [@spring.bind "multiPartBean"/] &lt;/div&gt; &lt;input type="submit" id="uploadButton" value="upload" /&gt; &lt;/form&gt; </code></pre> <p>javaScript:</p> <pre><code>function uploadFile(){ document.getElementById('inputFile').click(); } function uploadListener(){ $('#uploadForm').attr("action","[@spring.url '/assay/designability/uploadFile.htm'/]"); alert($('#uploadForm').attr('action')); this.document.getElementById("uploadForm").submit = true; alert("After Submit"); return false; } </code></pre> <p>server controller:</p> <pre><code>@Controller @PreAuthorize("isAuthenticated()") @RequestMapping("/assay/designability") @SessionAttributes({"assayAssessmentsInitializersBean","assayAssessmentsRequestsDetailsBean"}) public class AssayDesignabilityController extends AssayBaseController { @RequestMapping(value = "/uploadFile",method= RequestMethod.GET) public String uploadFile(@RequestParam(value = "file")Object file){ MultipartFile multipartFile=(MultipartFile)file; logger.info(multipartFile.getName()); return multipartFile.getName(); } } </code></pre> <p>now when I do all that, the response give me nonsense and when I try to debug I never get to the controller method. any help??</p> <p><strong>EDIT:</strong> now I try to submit it I've updated code and I have the same behavior no response.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload