Open sagivStekolshik opened 7 years ago
I use a java spring back end this is the server:
@Controller public class FileController { @Bean public CommonsMultipartResolver multipartResolver() { CommonsMultipartResolver resolver=new CommonsMultipartResolver(); resolver.setDefaultEncoding("utf-8"); return resolver; } @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/upload") public void upload(@RequestParam("file") MultipartFile file ) throws IOException { if (!file.isEmpty()) { System.out.println(String.format("receive %s", file.getName())); } } }
for some resone i get 400 Bad Request headers when i try to send an image thats not a .gif file. for a gif it works fine. my service that upload is
Upload.upload({ url: '/upload', data: { file: file } }).then(function (resp) { console.log("file uploaded",resp) }, function (err) { console.log("somthing went wrong",err) }, function (evt) { console.log("uploading",evt) })
hope someone can shed some light on this mystery
Did you try without your CommonsMultipartResolver Bean ? I'm using the default one and it is fine for me.
I use a java spring back end this is the server:
for some resone i get 400 Bad Request headers when i try to send an image thats not a .gif file. for a gif it works fine. my service that upload is
hope someone can shed some light on this mystery