JavaZOOM Web Site UploadBean homepage
  Software
  
Installation
  
Developer Guide
  
API & Design
  
License

<< back

- Installation -

UploadBean is a JAVA/JSP/Servlets upload component.

Read [General] instructions to install UploadBean samples on your servlet engine.

A [WAR] archive is available to make UploadBean installation easier. It needs a servlet engine SERVLETS 2.2+ API compliant or a J2EE1.2+ compliant applications server. See installation instructions.

Any problem ? Read the [FAQ] first. Still a problem ? Post your question to our online JSP Forum.

General Installation

Basically, our download package structure is SERVLETS 2.2+ compliant.

Click to zoom inYou will find JAR files under a WEB-INF/lib folder. The standardized deployment descriptor file (web.xml) under WEB-INF/ folder and JSP files under / folder (document root). Most of servlet engines are compliants with this structure so UploadBean installation is as easy as a copy/paste.



Here are basic steps to install UploadBean on your servlet engine :

  1. Add cos.jar, struts.jar, fileupload.jar and uploadbean.jar to the CLASSPATH of your web application.
    (e.g. : Put these files under WEB-INF/lib/).
  2. Copy JSP samples : SimpleUpload.jsp, MultipleUploads.jsp, DatabaseUpload.jsp, LargeUpload.jsp, WmlUpload.jsp, ExceptionHandler.jsp into the documentRoot of your web application.
    (e.g. : Put all these under a folder uploadbean/ in your web server).
  3. Edit SimpleUpload.jsp to modify upload parameters (store folder) before launching your servlet engine.
    Browse the developer guide to learn more about UploadBean parameters.
  4. Run UploadBean samples :
    Documentation : http://yourserver.com/uploadbean/documentation/index.html
    Sample 1 : http://yourserver.com/uploadbean/SimpleUpload.jsp
    Sample 2 : http://yourserver.com/uploadbean/MultipleUploads.jsp
    Sample 3: http://yourserver.com/uploadbean/DatabaseUpload.jsp
    Sample 4: http://yourserver.com/uploadbean/LargeUpload.jsp
    Sample 5: http://yourserver.com/uploadbean/WmlUpload.jsp
WAR Installation

UploadBean is also available as a WAR archive. It's a SERVLETS 2.2 standard archive for Web Applications.
What does it mean ?... It means that WAR installation is as easy as a copy/paste, regardless to the servlet engine vendor.

  1. To install UploadBean WAR archive, copy uploadbean.war under the webapps folder of your servlet engine before running it. That's all :-)
    Note that webapps folder depends on your servlet engine. It could be webapps/, applications/ ... The WAR file will be automatically uncompressed under uploadbean/ folder.

  2. Run UploadBean for the first time :
    Documentation : http://yourserver.com/uploadbean/documentation/index.html
    Sample 1 : http://yourserver.com/uploadbean/SimpleUpload.jsp
    Sample 2 : http://yourserver.com/uploadbean/MultipleUploads.jsp
    Sample 3: http://yourserver.com/uploadbean/DatabaseUpload.jsp
    Sample 4: http://yourserver.com/uploadbean/LargeUpload.jsp
    Sample 4: http://yourserver.com/uploadbean/WmlUpload.jsp
    Note that at this step, UploadBean is running but not configured yet.

  3. Once launched for the first time, stop the servlet engine to configure JSP samples as you need. You should modify upload store folder and/or upload store ZIP archive. Browse the developer guide to learn more about UploadBean parameters.

The UploadBean WAR archive is downloadable at UploadBean HomePage.

FAQ
  • I get a 404 HTTP error when running SimpleUpload.jsp ?
    Check that ExceptionHandler.jsp file is in the same directory as SimpleUpload.jsp.
  • I get JSP Exception when running SimpleUpload.jsp ?
    SimpleUpload sample stores uploaded files under a folder. If this folder doesn't exist then UploadBean will try to create one. It will fail if the servlet engine doesn't have Read/Write access. Pay attention to use / or \\ as file separator too.
  • I get a OutOfMemoryError when running SimpleUpload.jsp ?
    Use LargeUpload.jsp script. It allows to upload large files (up to 2GB) with low memory usage. You have to setup a temporary folder too.
  • I get "uploads.zip not found" when running MultipleUploads.jsp ?
    MultipleUploads sample stores uploaded files under a ZIP archive. If this archive doesn't exist then UploadBean will try to create one. It will fail if the servlet engine doesn't have Read/Write access on this archive or on the parent folder.
  • I can't upload ZIP files with MultipleUploads.jsp ?
    Check the blacklist parameter in MultipleUploads.jsp sample.
  • I can't upload a big files (> 1MB) with MultipleUploads.jsp ?
    Check the filesizelimit parameter in MultipleUploads.jsp sample.
  • Why duplicate uploaded files are renamed ? I want them to be overwritten.
    Default "overwrite" property is set to "false". Duplicate uploaded files will be renamed by appending a timestamp after the extension. For instance, filename.zip will be renamed as filename.zip.1234569789. If "overwritepolicy" property is set to "nametimestamp" then it will be renamed as filename_123465789.zip. Set "overwrite" property to "true" to enable duplicate files overwriting.
  • Can UploadBean work with PDA or mobile phone with WML browser ?
    Yes, but you need a device that supports this feature. WmlUpload.jsp sample should work on most PDAs, smart phones and recent mobiles such as Nokia 6230i.

  • Is there any SQL script to create table for UploadBean + database store ?
    Yes, UploadBean has been tested under Oracle8i/9i (upload_oracle.sql), IBM DB2 UDB 7.2 (upload_db2.sql), PostGreSQL 7.3 (upload_postgresql.sql), MySQL 3.23.x/4.x/5.x (upload_mysql.sql), OpenBase (upload_openbase.sql) and SQLServer 2000.
  • DatabaseUpload.jsp returns an Exception ?
    Check that you've made modifications to <jsp:useBean ... /jsp:useBean> in DatabaseUpload.jsp that suits to your database configuration (Driver, URL, login, password). Check your JDBC driver is in CLASSPATH too.
  • How to make UploadBean map my own table and columns name ?
    Uncomment and update the following variables in DatabaseUpload.jsp :
     // UploadBean.SQLUPLOADTABLE = "UPLOADS";
     // UploadBean.SQLUPLOADID = "UPLOADID";
     // UploadBean.SQLUPLOADFILENAME = "FILENAME";
     // UploadBean.SQLUPLOADFILE = "BINARYFILE";
     // UploadBean.SQLUPLOADFILESIZE = "FILESIZE";
     // UploadBean.SQLUPLOADFILETYPE = "FILETYPE";
  • How to pass a custom UPLOADID ?
    Default UPLOADID generated by UploadBean is an integer based on epoch timestamp. You could pass your own UPLOADID through "dbstore.uploadid" in options parameter for store(...) method. Custom UPLOADID type could be what you need (Integer, String, Date ...) and must match to your database schema. For instance, if your UPLOADID database column is a VARCHAR(255) then you could have the following in DatabaseUpload.jsp :
     ...
     HashMap options = new HashMap();
     options.put("dbstore.uploadid",new String("id."+System.currentTimeMillis()));
     upBean.store(mrequest, "uploadfile", options);
     ...
  • Could UploadBean store file size and file type too ?
    Yes. First, your UPLOADS table must include FILESIZE (integer) and FILETYPE (varchar) columns. Second, you have to enable filesize and/or filetype in options parameter for store(...) method :
     ...
     HashMap options = new HashMap();
     options.put("dbstore.filesize","enabled");
     options.put("dbstore.filetype","enabled");
     upBean.store(mrequest, "uploadfile", options);
     ...
  • Could UploadBean store custom record in UPLOADS table ?
    Yes, UploadBean could store custom column(s) through "dbstore.customcolumn" property in options parameter for store(...) method. For instance, if you have a CREATED_DATE column in your UPLOADS table then you could pass the date instance to be stored through :
     ...
     HashMap options = new HashMap();
     options.put("dbstore.customcolumn.created_date",new Date());
     upBean.store(mrequest, "uploadfile", options);
     ...
  • I'm not able to upload a file > 1MB under MySQL ?
    Yes, it's a MySQL limitation. You have to increase default "max_allowed_packet" in your my.ini MySQL configuration file such as :
     set-variable = max_allowed_packet=10M
  • DatabaseUpload.jsp hangs with Oracle ?
    Check you're using LONG RAW and not BLOB in your Oracle upload table. For BLOB or CLOB support try the OracleLobDBStore add-on.

  • Should I use COS, STRUTS or CFU multipart parser ?
    SimpleUpload.jsp uses COS as default one but STRUTS and CFU ones are really good too. Try this link to learn more about pros and cons of multipart parsers.

  • Can UploadBean work under HTTPS ?
    Yes, both HTTP and HTTPS.

  • Cannot upload large files under IBM WebSphere4/Microsoft IIS ?
    When you upload the file larger than 60 KB, you might get "java.io.IOException: Max Content-Length exceeded" error. This is the bug of the WebSphere plugin for IIS, i.e. the plugin has the difficulties in the communication between WebSphere and IIS. To fix this bug, please apply the WebSphere eFix (WAS_Plugin_03-07-2003_4.0.x_cumulative).
  • Upload speed is slow from Internet Explorer to Solaris/Unix server ?
    It's a known issue from Microsoft OS (Windows). Upload from Windows client to Windows server is fine, Upload from Unix client to Unix is fine too but Upload from Windows (Internet Explorer or Mozilla) could be slow (up to 10 times lower). The solution is to increase winsocket buffer on your Windows client. Check out the following URL (Microsoft support) to know which registry key to modify :
    http://support.microsoft.com/default.aspx?scid=kb;en-us;329781

  • How to upload folders (with subfolders) ?
    Browsers only allow to upload files not folders. If you need to upload a folder with all subfolders then you should try jClientUpload Applet. It also includes progress bar, copy/paste and drag&drop features.
  • How can I check or download a file uploaded in database ?
    We provide another JAVA/JSP/Servlet component : Download4J that downloads files from any folder, ZIP archive or Database.
  • How to add a progress bar when file is uploading ?
    You have to select Struts or Cfu parser and implement your own UploadListener. You could find a ProgressStatus sample in our UploadBean add-ons section.
  • How to rename file after uploading ?
    You could find a FileMover plugin in our UploadBean add-ons section.
  • How to upload images into MS Access 97/2000 with UploadBean ?
    Download .mdb file from http://www.jamiessoftware.tk/misc/getBinary.zip and checkout this thread from our online forum.

  • How to get StackTrace from ExceptionHandler ?
    Right-click and view HTML source, full StackTrace is in HTML comments.
  • Is there any lock for ZIP store access ?
    Yes, ZIP archive access is done through a synchronized Archiver class. There is only one instance of Archiver (singleton).
  • How to pass custom parameter to UploadBean ?
    You can pass parameter(s) either in the URL :
      http://server.com/upload.jsp?customparam=customvalue
    or in the HTML form as an hidden field :
      <input type="hidden" name="customparam" value="customvalue"/>
    Then, in the JSP :
    <%
    ...
    String value = mrequest.getParameter("customparam");
    ...
    %>


 
[News] [Applets] [Servlets] [Services] [Projects] [Links] [About]
 

Copyright © JavaZOOM 1999-2006

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U. S. and other countries.
All other company and/or product names are the property of their respective owners.