Thanks to clarifying my question.

I am thinking that the problem could be:

• Apache Tomcat 10.1.3
• Spring Boot 3.4.4
• or my IDE when I am creating the war

For your example, are you using tomcat and Spring Boot? If it is yes, what 
version?

Thanks for the assistance.

Regards
On 12 May 2025 at 8:43:31 AM -0600, Ute Kaiser <ut...@web.de.invalid>, wrote:
> I am also sorry because I can not see the difference why my upload is working 
> and yours is not.
>
> Best regards
> Ute
>
> > Gesendet: Samstag, 10. Mai 2025 um 18:45
> > Von: "Jesus Moreno" <jesus...@gmail.com>
> > An: user@struts.apache.org, "Struts Users Mailing List" 
> > <user@struts.apache.org>
> > Betreff: Re: Aw: File Upload Failure in Struts 7.0.3 Migration - 
> > UploadedFilesAware Implementation Issue
> >
> > Ohh sorry about my current configuration that I shared but I was trying 
> > many options. First I was trying exactly refer to the documentation but I 
> > did not have success.
> >
> > 1. According to the docs, it’s unnecessary put interceptor refer again, 
> > because defaultStack consider use actionFileUpload interceptor but I 
> > referred manually. (I suppose that is necessary but I was trying without 
> > both refers, actionFileUpload and defaultStack and nothing)
> > 2. Mi jsp looks like this:
> >
> > <s:form action="myAction" enctype="multipart/form-data" method="POST">
> > <s:file name=“upload” label=“Select a file” />
> > <s:submit>Upload</s:submit>
> > </s:form>
> >
> >      3.  As you can see first I am trying to test a basic example because 
> > I’d like to understand how do I upload a file in the new version because I 
> > am migrating an app.
> >
> > Finally I did not understand if you had success to upload a file to the 
> > server. It is true?
> >
> > That’s why I ask for your support.
> >
> > I appreciate your assistance.
> >
> > Regards
> > On 10 May 2025 at 2:57:02 AM -0600, Ute Kaiser <ut...@web.de.invalid>, 
> > wrote:
> > > Hi,
> > >
> > > I tried the same last week for the first time, and here is my experience:
> > > 1.
> > > WARN [org.apache.struts2.components.File] (default task-5) Struts has 
> > > detected a file upload UI tag (s:file) being used without a form set to 
> > > method 'POST'. This is probably an error!
> > > I used <s:form> and it was rendered automatically to method=post but to 
> > > get rid of the warning I had to set it manually
> > > <s:form action="myAction" enctype="multipart/form-data" method="POST">
> > > 2.
> > > MyAction.java looks pretty much the same as your HelloAction.java.
> > > But it helped me to use "newLogo" instead of "upload" in jsp and action 
> > > class.
> > > 3.
> > > I did not use any of your struts.xml configuration.
> > > a)
> > > <interceptor-ref name="actionFileUpload" />
> > > <interceptor-ref name="basicStack" />
> > > I think "actionFileUplad" is enclosed in the "defaultStack".
> > > I do not know about this "basicStack" you copied from the documentation 
> > > example.
> > > b)
> > > <constant name="struts.multipart.parser" value="jakarta" />
> > > <constant name="struts.multipart.maxSize" value="10485760" /> <!-- 10MB 
> > > -->
> > > <constant name="struts.multipart.saveDir" value="C:
> > > temp"/> <!-- Ruta absoluta -->
> > > Your saveDir looks strange to me.
> > > I use the default saveDir which turned out as a Wildfly tmp directory, 
> > > and then save to my targetPath with:
> > > Files.copy( ( (File) newLogo.getContent() ).toPath(), targetPath, 
> > > StandardCopyOption.REPLACE_EXISTING );
> > > 4.
> > > You did not give much info on your jsp.
> > > Here is my part: <s:file name="newLogo" accept="image/*"/>
> > >
> > > Perhaps you can strip down with less struts.xml configuration to find a 
> > > solution to your problem.
> > > Good luck
> > > Ute
> > >
> > >
> > > > Gesendet: Samstag, 10. Mai 2025 um 05:42
> > > > Von: "Jesus Moreno" <jesus...@gmail.com>
> > > > An: user@struts.apache.org
> > > > Betreff: File Upload Failure in Struts 7.0.3 Migration - 
> > > > UploadedFilesAware Implementation Issue
> > > >
> > > > I'm migrating an application from Struts 2.5 to 7.0.3 and encountering
> > > > persistent issues with file upload functionality despite following the
> > > > documentation.
> > > >
> > > > The UploadedFile object remains null in my action class, even with:
> > > >
> > > > - Correct UploadedFilesAware implementation
> > > > - Proper multipart form configuration
> > > > - Debug logs showing no uploaded files (ActionFileUploadInterceptor 
> > > > reports
> > > > empty acceptedFiles)
> > > >
> > > > Logs show:
> > > >
> > > > 2025-05-09 01:00:25 DEBUG ActionFileUploadInterceptor:179 - No files 
> > > > have
> > > > been uploaded/accepted
> > > > 2025-05-09 01:00:25 WARN File:79 - Struts has detected a file upload UI 
> > > > tag
> > > > (s:file) being used without a form set to method 'POST'
> > > > (Despite <s:form method="POST" enctype="multipart/form-data"> being
> > > > correctly declared)
> > > >
> > > > Basic action:
> > > > // Action
> > > > public class HelloAction extends ActionSupport implements
> > > > UploadedFilesAware {
> > > > public UploadedFile upload; // Always null
> > > >
> > > > @Override
> > > > public String execute() {
> > > > //do something with the file
> > > > return SUCCESS;
> > > > }
> > > > @Override
> > > > public void withUploadedFiles(List<UploadedFile> uploadedFiles) {
> > > > if (!uploadedFiles.isEmpty()) {
> > > > //This never execute cause always is empty
> > > > this.upload = uploadedFiles.get(0); // Never reached
> > > > }
> > > > }
> > > > }
> > > > struts.xml:
> > > > <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
> > > > Configuration 6.5//EN"
> > > > "https://struts.apache.org/dtds/struts-6.5.dtd";>
> > > > <struts>
> > > > <constant name="struts.multipart.parser" value="jakarta" />
> > > > <constant name="struts.multipart.maxSize" value="10485760" /> <!-- 10MB
> > > > -->
> > > > <constant name="struts.multipart.saveDir" value="C:
> > > > temp"/> <!-- Ruta absoluta -->
> > > > <package name="default" extends="struts-default">
> > > >
> > > > <action name=""><result>/hello.jsp</result></action>
> > > >
> > > > <action name="hello"
> > > > class="mx.com.jeser.ejemplo.actions.HelloAction">
> > > > <interceptor-ref name="actionFileUpload" />
> > > > <interceptor-ref name="basicStack" />
> > > > <result name="success">/success.jsp</result>
> > > > <result name="input">/input.jsp</result>
> > > > <result name="error">/error.jsp</result>
> > > > </action>
> > > > </package></struts>
> > > >
> > > > We are trying to implement the new features according the follow docs 
> > > > for
> > > > version 7.0.3:
> > > >
> > > > https://struts.apache.org/security/#defining-and-annotating-your-action-parameters
> > > > https://struts.apache.org/core-developers/action-file-upload-interceptor
> > > >
> > > > I would greatly appreciate your assistance in identifying if we might be
> > > > overlooking any undocumented requirements or configurations.
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > > For additional commands, e-mail: user-h...@struts.apache.org
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

Reply via email to