Javascript 使用ajax、jquery在spring中上载文件时出错?

Javascript 使用ajax、jquery在spring中上载文件时出错?,javascript,jquery,ajax,spring,Javascript,Jquery,Ajax,Spring,我上传文件有问题这里是我的代码 这是我的表单,其中打印位置图片是一个文件字段 <form method="POST" enctype="multipart/form-data" id="plotData" action="${request.contextpath}/FrontEnd/resources/saveplot?${_csrf.parameterName}=${_csrf.token}"> <fieldset> <table cla

我上传文件有问题这里是我的代码 这是我的表单,其中打印位置图片是一个文件字段

<form method="POST" enctype="multipart/form-data" id="plotData" action="${request.contextpath}/FrontEnd/resources/saveplot?${_csrf.parameterName}=${_csrf.token}">
    <fieldset>
        <table class="diffaddsocc">
            <input type="hidden" name="societyBlockId" />
            <tr>
                <td>
                    <div>
                        <label>Property Number:</label>
                        <input type="text" name="propertyNumber" id="adcssno" />
                    </div>
                </td>
                <td>
                    <div>
                        <label>Plot Size:</label>
                        <select name="size" id="sizeid321" class="sizeclass321"> 
                </select>
                    </div>
                    <div>
                        <label>Plot Front Face:</label>
                        <input type="text" name="plotFrontFace" id="adcssno" />
                    </div>
                </td>
                <td>
                    <div>
                        <label>Plot Location Picture:</label>
                        <input type="file" name="fileup" id="fileup" />

                    </div>
                </td>
                <td>
                    <div>
                        <label>Plot Location Picture Date:</label>
                        <input type="date" name="plotLocationPictureDate" />
                        <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
                        <input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
        </table>
    </fieldset>
</form>
这是我的控制器方法

@RequestMapping(value = "/saveplot", method = RequestMethod.POST)
    public @ResponseBody String Save(HttpServletRequest request,SocietyBlock societyBlock,
            Plot plot,  @RequestParam("fileup") MultipartFile file, BindingResult bindingResult, Model model, 
            @RequestParam(required = false) Boolean reverseBeforeSave) {

        String plottype = request.getParameter("plottypes12");
        String plotstatus = request.getParameter("plotstatus12"); 
        String[] plotfeatures = request.getParameterValues("plotfeas");
        plot.setSocietyBlock(societyBlock);
        propertyService.addPlot(plot, plottype, plotstatus, plotfeatures);
        return "success";
    }
我在网上尝试了20多个30多个教程,在stackoverflow中看到了很多问题,但它不能解决我的问题,我总是遇到这个错误

error: Feb 24, 2016 10:54:06 AM org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver logException
WARNING: Handler execution resulted in exception: Request method 'POST' not supported

请让我知道如何删除此错误我浪费了我的6个小时,但无法修复此错误。如果我的代码需要任何更改,请告诉我,如果有人为我解决此错误,这将非常值得赞赏

注意:您不需要使用
append()
将文件数据添加到FormData对象中,因为它已经包含在内。请尝试此操作,但仍会出现相同的错误@RoryMcCrossan@Ahmad你停止提交表格了吗?我不太明白你在问@Jai什么
error: Feb 24, 2016 10:54:06 AM org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver logException
WARNING: Handler execution resulted in exception: Request method 'POST' not supported