Skip to Content
Former Member
Jan 03, 2019 at 08:55 AM

[PageNotFound] Request method 'POST' not supported error while uploading a PDF file


Hi All, I have a reuirement to upload PDF file. While doing tht i see below exception WARN [hybrisHTTP15] [PageNotFound] Request method 'POST' not supported Tag file code snippet:

             <input name="remarks" type="text" class="order-cnfm-textbox upload-order" placeholder="Remarks">  
                 <input type="file" id="pdfFile" name=pdfFile >
                 <input type="submit"  id="importButton" />

Attributes in Form (cretaed setter & getter):

 public class StatementUploadForm
     private MultipartFile pdfFile;
     private String statementId;
     private String remarks;

Controller class code snippet:

     @RequestMapping(value = "/approveStatements", method = RequestMethod.POST)
     public String approveStatements(@ModelAttribute("StatementUploadForm") final StatementUploadForm StatementUploadForm)
             throws CMSItemNotFoundException
         final String action = "APPROVE_WITH_ISSUES";
         ARStatementFacade.updateStatementStatus(StatementUploadForm.getStatementId(), action,
                 StatementUploadForm.getRemarks(), StatementUploadForm.getPdfFile());

If i remove enctype="multipart/form-data" property from tag file.. and change name of pdfFile to other then mentioned in form.. In that case call go to controller else it break with exception: WARN [hybrisHTTP15] [PageNotFound] Request method 'POST' not supported

I also referrred ImportCSVPage controller but no luck. Kindly help.