2 Replies Latest reply on Jan 30, 2004 1:50 AM by dghemo

    File Upload Problem

    Erez Efrati Newbie

      I am using file upload with Struts/JBoss/Tomcat.

      My question is to where do I save and how the file. I need those files uploaded and saved in a directory that will not get deleted each time I deploy the application.

      Another question is can a Session bean do that or is it more advisable that the WEB servlet/Action do that?

      Thanks in advance,
      Erez

        • 1. Re: File Upload Problem
          Steve Ahlstrom Newbie

          I had the same question recently and jonlee came to my rescue so I thought I'd pass his wisdom on to you filtered throught my inconherency ...

          Create a directory named uploads.war (or whatever name you want, just make sure the directory has a .war extension) in your deploy directory. Create a WEB-INF directory with a jboss-web.xml file that defines the context. Then from your "real" application upload the graphic files to /usr/jboss/server/default/deploy/upload.war, either hard code the location or use an initparm to the servlet. To read the files from your app use http://www.mydomain.com/uploads/filename.gif. That works well and is an interesting way of serving static content with JBoss/Tomcat.

          Another solution was a lot more work for me to get going. I configured Apache to use Tomcat as a jsp container so I could then just put and get my graphics from docroot. The downside is Apache handing off requests to T
          f00
          omcat so there is some time penalty involved, but I'm not sure how much yet.

          • 2. Re: File Upload Problem
            dghemo Newbie

            Well, the upload.war solution is definitely good. At least somebody who helps me to solve my uploads pain. ;))

            thanks.
            Jan