[opencms-dev] how does multipart/form-data on JSP and parameters.get work?

Alexander Kandzior alex at opencms.org
Fri Nov 15 09:54:28 CET 2002


Nico,
 
you dont need any extra jars to handle multipart uploads. OpenCms
already does this for you.
 
On a JSP:
 
<%
com.opencms.file.CmsObject cms =
((com.opencms.flex.cache.CmsFlexRequest)request).getCmsObject();
Enumeration files = cms.getRequestContext().getRequest().getFileNames();
while(files.hasMoreElements()) {
    String filename = (String)files.nextElement();
    byte[] filecontent =
cms.getRequestContext().getRequest().getFile(filename);
    // do somthing with filename / filecontents here ...
}
%>
I did not try this code on an actual JSP page but this is the way things
work in general. 
For more examples see classes
"com.opencms.workplace.CmsNewResourceUpload" and
"com.opencms.core.CmsRequestHttpServlet".


Best Regards,
Alex.

Alexander Kandzior
OpenCms Group / Alkacon Software 
 
-----Original Message-----
From: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org] On Behalf Of Nico Krause
Sent: Thursday, November 14, 2002 11:52 AM
To: opencms-dev at opencms.com
Subject: [opencms-dev] how does multipart/form-data on JSP and
parameters.get work?


Hi All,
 
Does somebody tried uploading files (multipart/form-data) 
together with JSP-pages in OpenCMS?
 
I got currently following error in error log....
"Corrupt form data: premature ending"
 
I use the cos.jar (contains MultipartRequest) in a class which handles
the uploads. 
Normal Tomcat does the job. The cos.jar is also in the OpenCMS - lib
directory. (no exception no other exception is thrown...)
 
Does anybody has an example for me how does file upload works within
OpenCMS?
As normal template based method and maybe as JSP - page?
 
Thank you in advance - if possible.
 
Best Regards,
 
Nico
 
____________________________________
Nico Krause
NorthStar Communications GmbH
Wallbergstr. 20-22     85221 Dachau
Telefon: +49 (0) 81 31 / 9 96 87 - 53
Fax:      +49 (0) 81 31 / 9 96 87 - 29
Mobil:    +49 (0) 1 71 / 3 70 10 70
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20021115/d78bbb71/attachment.htm>


More information about the opencms-dev mailing list