Why not just use the ServletContext.getRealPath?

Additionally, it's kinda a bad idea to be placing uploaded content into your
webapp directory. It makes future deployments a bit more annoying. You could
use a dedicated (shared) context where you don't have any code for uploading
content. I've done it a few different ways. I've even used a directory above
the webapp directory.

Brandon

On Wed, Apr 1, 2009 at 12:08 AM, Leonard Gestrin <
[email protected]> wrote:

> Perhaps, you can have various configurations that you can pick depending on
> the OS version the app is running?
>
> System.getProperty("os.name") should give you OS name002E
>
>
>
> -----Original Message-----
> From: AK [mailto:[email protected]]
> Sent: Tuesday, March 31, 2009 6:57 PM
> To: [email protected]
> Subject: Re: [Stripes-users] Can't save file to disk
>
> AK <ama-l...@...> writes:
>
> >
> > I have the following code in a try block and am running up against the
> > following exception:
> >
> > java.io.FileNotFoundException: \dev\javalib\Stripes\projects\myApp\web
> > \imageUploads\75.jpg (The system cannot find the path specified)
> >
> > Here's the code:
> >
> ...
> > String imgDir = prop.getProperty("myApp.location.imageUploads");
> > logger.debug("*** dir from property: " + imgDir);
> >
>
> OK.  So much for write once, run anywhere.  If I change my imgPath to be on
> the
> C-drive, the file saves!
>
> String imgPath = "c:/" + imgDir + File.separator + newImageName;
>
> How is this supposed to be portable code (developing on Win and deploying
> on
> Lin) if I have to specif the app location based on the OS it's running on?
>  Am
> I doing something wrong that's put me in this conundrum?
>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to