on ‎2022 Jun 24 7:39 PM
<br>
When submitting the html form, all the values from input tags are binded to the properties of my Helper class, which I POST to the storefront controller as an enctype="multipart/form-data". In controller I have access to ALL the property values and I can proccess them, except for the MultipartFile property which has the value of null. I also tried with MediaType but returned value was also null. What do I do wrong? In which file should I append MultipartResolver bean if I am working in storefront extension?


P.S. I alo tried another way which is to POST a loaded file as a MultipartFile directly to the Controller, but I allways got an error "required request part 'file' is not present". But it is, isn't it?

Most interesting part is that I also created a testing Spring project (not Hybris) in which I did everythig exactly the same way and it works perfectly. I see that other guys have similar problems. What do we do wrong?
Request clarification before answering.
Hi Gorazd,
Did you add the multipartResolver bean to the web application context spring xml file like this? Otherwise multipart requests are not allowed.
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="${cmswebservices.multipartresolver.upload.maxsize}" />
<property name="maxInMemorySize" value="${cmswebservices.multipartresolver.memory.maxsize}" />
</bean>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Samuel
In web-application-spring.xml file have I uncluded this part
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="209715200" />
<property name="maxInMemorySize" value="10485760" />
</bean>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.