[opencms-dev] apache fileupload won't work with opencms

Ivan Jelenic ivan.jelenic at nbs.yu
Fri Sep 24 10:24:36 CEST 2004


Try to write a servlet which will extends OpenCms servlet and than use apache commons fileupload or you can use something like this:

// Create a JSP action element
CmsJspActionElement cmsJsp = new CmsJspActionElement(pageContext, request, response);

CmsObject cms = cmsJsp.getCmsObject();
String format = cmsJsp.getRequestContext().getRequest().getParameter("Format");


....

Enumeration files = cms.getRequestContext().getRequest().getFileNames();
String fileName = "";
byte[] filecontent = null;
while (files.hasMoreElements()) {
 fileName = (String) files.nextElement();
      filecontent = (byte[]) cmsJsp.getRequestContext().getRequest().getFile(fileName);
      File f = new File("D:/",fileName);
      DataOutputStream fo = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(f)));
      fo.write(filecontent);
      fo.close();
   }


  ----- Original Message ----- 
  From: Stieve Verheyden 
  To: opencms-dev at opencms.org 
  Sent: Thursday, September 23, 2004 11:48 PM
  Subject: [opencms-dev] apache fileupload won't work with opencms


  I'm trying to use the apache commons fileupload, but it won't work. I always get a empty list after a DiskFileUpload.parseRequest(request).

  I never get an Exception or anything else and I'm giving files with a html form with enctype="multipart/data-form".

  Can somebody help me or give me another method to upload files.

   

  thx



------------------------------------------------------------------------------




  _______________________________________________
  This mail is send to you from the opencms-dev mailing list
  To change your list options, or to unsubscribe from the list, please visit
  http://mail.opencms.org/mailman/listinfo/opencms-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040924/03ebbd5c/attachment.htm>


More information about the opencms-dev mailing list