You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Arpan <ar...@gmail.com> on 2015/01/09 12:27:13 UTC

File Upload error making request parameters empty

HI All,

We need to upload files.
Hence I am using defaultStack Interceptor, which uses file upload
interceptor.
If I select a large file to upload and fileupload interceptor displays
error message on the same page. I have few hidden fields, whose values are
pre populated. But when file upload error happens, my hidden fields values
become empty.

How to rectify this problem. Am I missing something.

Thanks

Re: File Upload error making request parameters empty

Posted by Christoph Nenning <Ch...@lex-com.net>.
> HI All,
> 
> We need to upload files.
> Hence I am using defaultStack Interceptor, which uses file upload
> interceptor.
> If I select a large file to upload and fileupload interceptor displays
> error message on the same page. I have few hidden fields, whose values 
are
> pre populated. But when file upload error happens, my hidden fields 
values
> become empty.
> 
> How to rectify this problem. Am I missing something.
> 
> Thanks


We had the same issue in some of our apps, too.
When the size of the uploaded file exceeds the configured max value the 
whole request body is skipped.

As workaround we put the hidden fields not in the form but appended them 
to the POST-URL.



See this page for configuration options regarding file upload:

https://cwiki.apache.org/confluence/display/S2PLUGINS/Advanced+Fileupload+Plugin



Regards,
Christoph

This Email was scanned by Sophos Anti Virus

Re: File Upload error making request parameters empty

Posted by Lukasz Lenart <lu...@apache.org>.
2015-02-17 7:16 GMT+01:00 Arpan <ar...@gmail.com>:
> Moreover here the error message is hard coded in the java file. It may not
> be acceptable for many companies.

Please register a ticket in JIRA


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: File Upload error making request parameters empty

Posted by Arpan <ar...@gmail.com>.
Moreover here the error message is hard coded in the java file. It may not
be acceptable for many companies.

On Mon, Feb 16, 2015 at 6:34 PM, Lukasz Lenart <lu...@apache.org>
wrote:

> 2015-02-16 13:56 GMT+01:00 Christoph Nenning <
> Christoph.Nenning@lex-com.net>:
> >>
> >> Thanks a Lot. Upgrading the struts2 version to 2.3.20 and using the
> >> alternative libraries, solved the problem.
> >> But additionally while using the alternate library , I needed to declare
> >> bellow constant
> >> <constant name="struts.multipart.bufferSize" value="10240" />
> >>
> >> Is it necessary?
> >>
> >
> >
> > It seems that has been forgotten. So yes, currently it is necessary that
> > you add it yourself.
> >
> >
> >
> > @Lukasz
> > Should this be added to 'default.properties'?
> > Create jira first? Or can it just be committed?
>
> Yes, please create JIRA ticket first as this is a simple bug :)
> And it can be solved by adding "required = false" as below in
> JakartaStreamMultiPartRequest. "this.bufferSize" is already set to
> "BUFFER_SIZE = 10240;"
>
> @Inject(value = StrutsConstants.STRUTS_MULTIPART_BUFFERSIZE, required =
> false)
> public void setBufferSize(String bufferSize) {
>     this.bufferSize = Integer.parseInt(bufferSize);
> }
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: File Upload error making request parameters empty

Posted by Lukasz Lenart <lu...@apache.org>.
2015-02-16 13:56 GMT+01:00 Christoph Nenning <Ch...@lex-com.net>:
>>
>> Thanks a Lot. Upgrading the struts2 version to 2.3.20 and using the
>> alternative libraries, solved the problem.
>> But additionally while using the alternate library , I needed to declare
>> bellow constant
>> <constant name="struts.multipart.bufferSize" value="10240" />
>>
>> Is it necessary?
>>
>
>
> It seems that has been forgotten. So yes, currently it is necessary that
> you add it yourself.
>
>
>
> @Lukasz
> Should this be added to 'default.properties'?
> Create jira first? Or can it just be committed?

Yes, please create JIRA ticket first as this is a simple bug :)
And it can be solved by adding "required = false" as below in
JakartaStreamMultiPartRequest. "this.bufferSize" is already set to
"BUFFER_SIZE = 10240;"

@Inject(value = StrutsConstants.STRUTS_MULTIPART_BUFFERSIZE, required = false)
public void setBufferSize(String bufferSize) {
    this.bufferSize = Integer.parseInt(bufferSize);
}


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: File Upload error making request parameters empty

Posted by Christoph Nenning <Ch...@lex-com.net>.
> 
> Thanks a Lot. Upgrading the struts2 version to 2.3.20 and using the
> alternative libraries, solved the problem.
> But additionally while using the alternate library , I needed to declare
> bellow constant
> <constant name="struts.multipart.bufferSize" value="10240" />
> 
> Is it necessary?
> 


It seems that has been forgotten. So yes, currently it is necessary that 
you add it yourself.



@Lukasz
Should this be added to 'default.properties'?
Create jira first? Or can it just be committed?





> On Fri, Jan 9, 2015 at 6:49 PM, Christoph Nenning <
> Christoph.Nenning@lex-com.net> wrote:
> 
> > > > HI All,
> > > >
> > > > We need to upload files.
> > > > Hence I am using defaultStack Interceptor, which uses file upload
> > > > interceptor.
> > > > If I select a large file to upload and fileupload interceptor 
displays
> > > > error message on the same page. I have few hidden fields, whose 
values
> > are
> > > > pre populated. But when file upload error happens, my hidden 
fields
> > values
> > > > become empty.
> > > >
> > > > How to rectify this problem. Am I missing something.
> > >
> > > I think it's related to that
> > > https://issues.apache.org/jira/browse/WW-3025
> > >
> >
> > Oh, the fix for WW-3025 is included in 2.3.20. This is good to know !
> >
> >
> >
> > @Arpan
> > That means your problem will go away when you upgrade to latest struts
> > version.
> >
> >
> > This Email was scanned by Sophos Anti Virus
> >

This Email was scanned by Sophos Anti Virus

Re: File Upload error making request parameters empty

Posted by Arpan <ar...@gmail.com>.
Thanks a Lot. Upgrading the struts2 version to 2.3.20 and using the
alternative libraries, solved the problem.
But additionally while using the alternate library , I needed to declare
bellow constant
<constant name="struts.multipart.bufferSize" value="10240" />

Is it necessary?

On Fri, Jan 9, 2015 at 6:49 PM, Christoph Nenning <
Christoph.Nenning@lex-com.net> wrote:

> > > HI All,
> > >
> > > We need to upload files.
> > > Hence I am using defaultStack Interceptor, which uses file upload
> > > interceptor.
> > > If I select a large file to upload and fileupload interceptor displays
> > > error message on the same page. I have few hidden fields, whose values
> are
> > > pre populated. But when file upload error happens, my hidden fields
> values
> > > become empty.
> > >
> > > How to rectify this problem. Am I missing something.
> >
> > I think it's related to that
> > https://issues.apache.org/jira/browse/WW-3025
> >
>
> Oh, the fix for WW-3025 is included in 2.3.20. This is good to know !
>
>
>
> @Arpan
> That means your problem will go away when you upgrade to latest struts
> version.
>
>
> This Email was scanned by Sophos Anti Virus
>

Re: File Upload error making request parameters empty

Posted by Christoph Nenning <Ch...@lex-com.net>.
> > HI All,
> >
> > We need to upload files.
> > Hence I am using defaultStack Interceptor, which uses file upload
> > interceptor.
> > If I select a large file to upload and fileupload interceptor displays
> > error message on the same page. I have few hidden fields, whose values 
are
> > pre populated. But when file upload error happens, my hidden fields 
values
> > become empty.
> >
> > How to rectify this problem. Am I missing something.
> 
> I think it's related to that
> https://issues.apache.org/jira/browse/WW-3025
> 

Oh, the fix for WW-3025 is included in 2.3.20. This is good to know !



@Arpan
That means your problem will go away when you upgrade to latest struts 
version.


This Email was scanned by Sophos Anti Virus

Re: File Upload error making request parameters empty

Posted by Lukasz Lenart <lu...@apache.org>.
2015-01-09 12:27 GMT+01:00 Arpan <ar...@gmail.com>:
> HI All,
>
> We need to upload files.
> Hence I am using defaultStack Interceptor, which uses file upload
> interceptor.
> If I select a large file to upload and fileupload interceptor displays
> error message on the same page. I have few hidden fields, whose values are
> pre populated. But when file upload error happens, my hidden fields values
> become empty.
>
> How to rectify this problem. Am I missing something.

I think it's related to that
https://issues.apache.org/jira/browse/WW-3025

and to that one as well
https://issues.apache.org/jira/browse/FILEUPLOAD-194

you can use some other alternative
https://cwiki.apache.org/confluence/display/WW/File+Upload#FileUpload-AlternateLibraries


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org