• hessian
  • quercus/php
  • resin 3.0
  • resin 3.1
  • resin 4.0

  • changes
  • configuration
  • examples
  • installing
  • overview
  • starting

  • guide: admin
  • admin
  • amber
  • bam
  • caching
  • clustering
  • comet
  • database
  • deployment
  • ejb 3.0
  • embedding
  • filters
  • ioc
  • jsf
  • jsp
  • logging
  • messaging
  • quercus
  • remoting
  • security
  • resources
  • servlets
  • third-party
  • troubleshooting
  • virtual host
  • watchdog
  • webapp
  • HOME
  • ABOUT
  • ARTICLES
  • WORKSPACE
  • NEWS
  • PROJECTS
  • PRODUCTS
  • STORE
resin example $resin/java_tut/multipart.xtp Multipart forms let browsers upload files to the website Multipart forms let browsers upload files to the website. They also have better handling for internationalization.

Multipart forms let browsers upload files to the website. They also have better handling for internationalization.

Default form handling uses the application/x-www-form-urlencoded content type. Multipart forms use the multipart/form-data encoding.

<form action="multipart.jsp" method="POST" enctype="multipart/form-data"> <input type="file" name="file"><br> <input type="submit"> </form>

Resin's file uploading stores the uploaded file in a temporary directory. A servlet can get the filename for the temporary file by retrieving the form parameter. In the example, getParameter("file") gets the filename.

Servlets will generally copy the contents of the file to its permanent storage, whether stored on disk or in a database.

<% String fileName = request.getParameter("file"); FileInputStream is = new FileInputStream(fileName); int ch; while ((ch = is.read()) >= 0) out.print((char) ch); is.close(); %>
  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • SALES |
  • WIKI
Copyright (c) 1998-2009 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.