You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Chris Joelly <ch...@unycom.com> on 2004/01/30 15:00:38 UTC

file uploads ...

Hello again!

i want to use the UploadService but have problems when i upload files
bigger than configured in TurbineResources.properties.

so i have read the java api of the uploadservice classes and found a
statement that uploads can be handled outomatically by parameterparser
or by an action. and that the turbine property
services.UploadService.automatic should be set to false ...

do i have to handle the file uploads with this stuff to avoid
TurbineExceptions?

has anybody tried this with success?

thx, Chris

-- 
mit freundlichen Grüßen / with kind regards
 
Ing. Christian Jölly @ Solutions
unycom  Information Technology Services GmbH
A-8042 Graz | Schmiedlstraße 1 / III

Tel: ++43 (0)316 / 818 828 - 30
Fax: ++43 (0)316 / 818 828 - 38
chris.joelly@unycom.com
http://www.unycom.com

Cool war die Stelle, als jemand aus dem Publikum ihn mit der
spanischen Inquisition verglich.
		-- Nils Magnus

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


Re: file uploads ...

Posted by Brian Lawler <br...@tribenetwork.com>.
I have this exact same issue.  The way that I got around it was to  
rework the Upload service to add an error message to the parameters  
parser if the file is too big, rather than just throwing out the  
exception.  Then, in my code I look for the FileItem in the parameter  
parser using the field name where I expect to find it, and if I find a  
String instead then I consider this a failed field validation and  
re-render the original multipart form with the error message.

-Brian

On Friday, January 30, 2004, at 06:28  AM, Peter Riegersperger wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> On Jan 30, 2004, at 15:00, Chris Joelly wrote:
>
>> Hello again!
>>
>> i want to use the UploadService but have problems when i upload files
>> bigger than configured in TurbineResources.properties.
>>
>> so i have read the java api of the uploadservice classes and found a
>> statement that uploads can be handled outomatically by parameterparser
>> or by an action. and that the turbine property
>> services.UploadService.automatic should be set to false ...
>>
>> do i have to handle the file uploads with this stuff to avoid
>> TurbineExceptions?
>
> not necessarily. i have the same problem, and just found a way to make  
> this "work".
> this is a dirty work around that fits my purposes, because i neither  
> have time nor the incentive to switch away from the turbine upload  
> service (which works fine, apart from this issue). ymww.
>
> as pretext, i assumed that
> "There is a switch somwhere in the properties where one can say if the
> service should handle this exception which is default or the app  
> handles the
> exception, but this doesn't work properly. "
> http://www.mail-archive.com/turbine-user@jakarta.apache.org/ 
> msg13973.html
>
> is correct. i didn't try.
>
> what i made (this very minute):
>
> before the exception is thrown, the isAuthorized(RunData data) method  
> of your action class is executed.
> in this method, i put a marker in the session:
> data.getSession().setAttribute("action", "post");
>
> the exception will lead to the the screen template set to error.vm (or  
> whatever you have in your config file).
> the $processingException and $stacktrace references will be empty, so  
> if you test for something like:
>
> #if ($data.getSession().getAttribute("action").equals("post") &&  
> !$processingException)
>
> than there is a chance that the file was too big.
>
> hope that helps, and if somebody comes up with a better solution, i'd  
> be gracious.
>
> peter riegersperger
> - -
> subnet
> platform for media art and experimental technologies
> muehlbacherhofweg 5 - 5020 salzburg / austria - www.subnet.at -  
> +43/662/842897
> - -
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (Darwin)
>
> iD8DBQFAGmoHIMP39JYOy9IRAsGeAJ9wGoFd3i70s9JOMOPxp8GF4l3cQwCgg1Xf
> uPW7sXIMSfYXA8LVjn1a0b0=
> =xe71
> -----END PGP SIGNATURE-----
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>


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


Re: file uploads ...

Posted by Peter Riegersperger <ri...@subnet.at>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jan 30, 2004, at 15:00, Chris Joelly wrote:

> Hello again!
>
> i want to use the UploadService but have problems when i upload files
> bigger than configured in TurbineResources.properties.
>
> so i have read the java api of the uploadservice classes and found a
> statement that uploads can be handled outomatically by parameterparser
> or by an action. and that the turbine property
> services.UploadService.automatic should be set to false ...
>
> do i have to handle the file uploads with this stuff to avoid
> TurbineExceptions?

not necessarily. i have the same problem, and just found a way to make  
this "work".
this is a dirty work around that fits my purposes, because i neither  
have time nor the incentive to switch away from the turbine upload  
service (which works fine, apart from this issue). ymww.

as pretext, i assumed that
"There is a switch somwhere in the properties where one can say if the
service should handle this exception which is default or the app  
handles the
exception, but this doesn't work properly. "
http://www.mail-archive.com/turbine-user@jakarta.apache.org/ 
msg13973.html

is correct. i didn't try.

what i made (this very minute):

before the exception is thrown, the isAuthorized(RunData data) method  
of your action class is executed.
in this method, i put a marker in the session:
data.getSession().setAttribute("action", "post");

the exception will lead to the the screen template set to error.vm (or  
whatever you have in your config file).
the $processingException and $stacktrace references will be empty, so  
if you test for something like:

#if ($data.getSession().getAttribute("action").equals("post") &&  
!$processingException)

than there is a chance that the file was too big.

hope that helps, and if somebody comes up with a better solution, i'd  
be gracious.

peter riegersperger
- -
subnet
platform for media art and experimental technologies
muehlbacherhofweg 5 - 5020 salzburg / austria - www.subnet.at -  
+43/662/842897
- -
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFAGmoHIMP39JYOy9IRAsGeAJ9wGoFd3i70s9JOMOPxp8GF4l3cQwCgg1Xf
uPW7sXIMSfYXA8LVjn1a0b0=
=xe71
-----END PGP SIGNATURE-----


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