tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: FileUploadBase$IOFileUploadException
Date Thu, 02 Sep 2010 02:25:12 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul,

On 9/1/2010 6:58 PM, Paul Szynol wrote:
> Ah, now I see what you mean.  So the reason the exception isn't being
> thrown when I increase the threshold value is that the image isn't being
> written to disk in the first place.  That makes more sense.  But the odd
> part of it (in my configuration, at least) is that the file permissions
> do allow fileupload to write the file...so, I guess I still don't
> understand what's causing the exception.

I'm reading this: http://commons.apache.org/fileupload/using.html

Are you calling factory.setRepository(File)?

If not, you're getting whatever the default is, which is
System.getProperty("java.io.tmpdir"), which might actually be "/" in
your case.

You should probably be doing something like this:

ServletContext app = request.getServletContext();
factory.setRepository((File)app.getAttribute("javax.servlet.context.tempdir"));

ServletFileUpload upload = new ServletFileUpload(factory);

...

This will allow commons-fileupload to use the spec-defined scratch
directory for files your webapp needs to write. Be aware that the spec
makes no statements about how much stuff you can shove into that
directory, so some containers may limit you in some way (I don't believe
Tomcat has any such limits, but YMMV).

Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAkx/CwgACgkQ9CaO5/Lv0PC9SgCXfnK0xldzZFPal+Masbn6yM3u
SQCeK1ku59wniXGJupko/2bclOVkyjI=
=wtBx
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message