You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Caroline Jen <ji...@yahoo.com> on 2004/10/13 17:29:48 UTC

Where Is the Best Place To Store Files?

I am using the Struts to build a web application.  I
am going to store some files (the files can be .doc,
.txt, .pdf, .jpg, whatever) on the server; e.g.
somewhere in my web application.

Where is the proper and best place to store files? 
$TOMCAT\webapps\MyApplication\????

Thanks for suggestions.


		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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


Re: Where Is the Best Place To Store Files?

Posted by Caroline Jen <ji...@yahoo.com>.
Those files will be uploaded to the Tomcat container
(no Apache involved) when the application is deployed.

The database storage is out of the picture at this
point of time.

If the uploaded files do not have to be protected (any
user can access them), where is the proper location to
store them?
--- Wendy Smoak <ja...@wendysmoak.com> wrote:

> From: "Caroline Jen" <ji...@yahoo.com>
> > I am using the Struts to build a web application. 
> I
> > am going to store some files (the files can be
> .doc,
> > .txt, .pdf, .jpg, whatever) on the server; e.g.
> > somewhere in my web application.
> >
> > Where is the proper and best place to store files?
> > $TOMCAT\webapps\MyApplication\????
> >
> > Thanks for suggestions.
> 
> Are these part of the webapp at deployment time, or
> are they uploaded by
> users or otherwise created by the webapp at runtime?
> 
> If you're just talking about static resources,
> graphics for your pages,
> etc., then anywhere other than under WEB-INF is
> visible to the browser, just
> make a sensible directory structure.
> 
> If you're talking about run-time file creation or
> uploads... keep in mind
> that a webapp can run unexploded from a .war file...
> in that case you can't
> write to a directory within your webapp, because it
> doesn't exist.
> 
> The Servlet container is required to provide you a
> place to put temporary
> files, though suspect that location isn't visible
> from a browser.  Check the
> Servlet Specification for more info.
> 
> If a database is out of the question, then just find
> somewhere in your file
> system that's visible to a browser, and write them
> there.  I would configure
> the location you choose as a parameter in web.xml,
> so it's documented and
> can be changed easily.
> 
>  Do they need to be protected, or can anyone access
> them?  In a later
> message, you mention putting them under WEB-INF as
> if you need to restrict
> access to them, so I'm not sure.  Is this
> Tomcat-only or is Apache involved?
> We've used .htaccess to restrict access to files to
> only the IP address the
> request came from.
> 
> HTH,
> -- 
> Wendy Smoak
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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


Re: Where Is the Best Place To Store Files?

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Caroline Jen" <ji...@yahoo.com>
> I am using the Struts to build a web application.  I
> am going to store some files (the files can be .doc,
> .txt, .pdf, .jpg, whatever) on the server; e.g.
> somewhere in my web application.
>
> Where is the proper and best place to store files?
> $TOMCAT\webapps\MyApplication\????
>
> Thanks for suggestions.

Are these part of the webapp at deployment time, or are they uploaded by
users or otherwise created by the webapp at runtime?

If you're just talking about static resources, graphics for your pages,
etc., then anywhere other than under WEB-INF is visible to the browser, just
make a sensible directory structure.

If you're talking about run-time file creation or uploads... keep in mind
that a webapp can run unexploded from a .war file... in that case you can't
write to a directory within your webapp, because it doesn't exist.

The Servlet container is required to provide you a place to put temporary
files, though suspect that location isn't visible from a browser.  Check the
Servlet Specification for more info.

If a database is out of the question, then just find somewhere in your file
system that's visible to a browser, and write them there.  I would configure
the location you choose as a parameter in web.xml, so it's documented and
can be changed easily.

 Do they need to be protected, or can anyone access them?  In a later
message, you mention putting them under WEB-INF as if you need to restrict
access to them, so I'm not sure.  Is this Tomcat-only or is Apache involved?
We've used .htaccess to restrict access to files to only the IP address the
request came from.

HTH,
-- 
Wendy Smoak


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