#Spring upload file ( hibernate)

27 messages · Page 1 of 1 (latest)

sharp cargo
#

Why i can't upload file even though have right name of @RequestParam

pale umbraBOT
#

This post has been reserved for your question.

Hey @sharp cargo! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

sharp cargo
#

u can dowload this file and test this problem

errant rover
#

MultipartFile assumes that the HTTP request is multipart as well. adding enctype="multipart/form-data" to your form element should be your first step.

sharp cargo
#

yes, i had added it before , but it not working

#

@errant rover

north sparrow
#

your controller's multipart parameter should be annotated as a @RequestBody

#

you can't send a multipart request in a single query parameter of a request

sharp cargo
north sparrow
#

well, maybe it's able to get it to work somehow, but semantically it makes no sense to mark a multipart file as a request param

sharp cargo
#

can i know ur solution when using multipart file

#

my solution is create a class file like this

#

and registry it to @wind martenuration

north sparrow
#

usually I just add it to a controller's @PostMapping method

sharp cargo
#

can i have the example

north sparrow
#

maybe I have one from one of my old projects

#

actually I can't find a non-proprietary example

sharp cargo
pale umbraBOT
# sharp cargo anyway, thanks ur help

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

sharp cargo
#

i will wait for anyone can solve this problem

#

Meanwhile, i will use spring boot to solve this upload file. Even i still want to know what problem in my code. I wish anyguy here can find it. Haizz.

sharp cargo
#

i fixed this problem (with my friend help)