Discussions

Web tier: servlets, JSP, Web frameworks: upload files/images

  1. upload files/images (1 messages)

    How to upload files/images from a web browser to a webserver like apache tomcat and how to save/retrive the file/image at web server for further use. Please help me in this regard
  2. upload files/images[ Go to top ]

    There is a widely used Jakarta component (it's named commons-fileupload).

    http://jakarta.apache.org/commons/fileupload

    There are a few things you must consider (no matter what file upload component you use):

    . Do you want to let the uploaded files available for download? In this case it makes things easier to deploy your application in an exploded (not archived) format;

    . Is your J2EE server (or Tomcat) behind a web server (like IIS or Apache)? In that case the uploaded files must be copied to the web server layer;

    . Is there load-balancing scheme (or a cluster)? In that case, the uploaded file must be available to ALL machines;

    Uploading the file directly into your application's folder is a bad design, acceptable only in the simplest applications. A simple redeployment, for example, might delete all the previously uploaded files.