R: [opencms-dev] Use of commons-fileupload with OpenCMS

Campione Aldo aldo.campione at siemens.com
Thu Mar 18 12:25:01 CET 2004


it works fine for me too.
I have the out of memory error when I try to post big files (upper than
15MB)

-----Messaggio originale-----
Da: Ivan Jelenic [mailto:ivan.jelenic at nbs.yu] 
Inviato: giovedì 18 marzo 2004 12.19
A: opencms-dev at opencms.org
Oggetto: Re: [opencms-dev] Use of commons-fileupload with OpenCMS


Hi,
 
This works fine for me.
 
// Create a JSP action element
CmsJspActionElement cmsJsp = new CmsJspActionElement(pageContext, request,
response);
 
CmsObject cms = cmsJsp.getCmsObject();

Enumeration files = cms.getRequestContext().getRequest().getFileNames();

in while loop try this:
 
filecontent = (byte[])
cmsJsp.getRequestContext().getRequest().getFile(fileName);
 
Works OK in OpenCMS 5.0.0 (RH 8, MySql 4.0.15, jdk 1.4)
 
Best regards,
 
Ivan Jelenic


----- Original Message ----- 
From: Campione Aldo <mailto:aldo.campione at siemens.com>  
To: opencms-dev at opencms.org <mailto:opencms-dev at opencms.org>  
Sent: Thursday, March 18, 2004 9:55 AM
Subject: R: [opencms-dev] Use of commons-fileupload with OpenCMS


Hi Alexander, 

I've tried your code but when I post a multipart-form data to a JSP page I
get anout of memory error. 
I've tried this under tomact and it works. 

Can you help me ? 



-----Messaggio originale----- 
Da: Alexander Kandzior [mailto:alex at opencms.org <mailto:alex at opencms.org> ] 
Inviato: venerdì 6 febbraio 2004 12.11 
A: opencms-dev at opencms.org <mailto:opencms-dev at opencms.org>  
Oggetto: RE: [opencms-dev] Use of commons-fileupload with OpenCMS 


In fact OpenCms 5 automatically resolves the MIME Multipart for you so you
don't need to care about this in your OpenCms application. 

You must use something like this to access the contents of binary 
attachements: 

CmsObject cms; 
... 
Enumeration e = cms.getRequestContext().getRequest().getFileNames(); 
while (e.hasMoreElements()) { 
   String name = (String)e.nextElement(); 
   byte[] content = cms.getRequestContext().getRequest().getFile(name); 
   // do something with content 
} 

Best Regards, 
Alex. 

Alexander Kandzior 
Alkacon Software - The OpenCms Experts 
http://www.alkacon.com <http://www.alkacon.com>  

> -----Original Message----- 
> From: opencms-dev-admin at opencms.org 
> [mailto:opencms-dev-admin at opencms.org
<mailto:opencms-dev-admin at opencms.org> ] On Behalf Of Ben Rometsch 
> Sent: Friday, February 06, 2004 10:34 AM 
> To: opencms-dev at opencms.org 
> Subject: Re: [opencms-dev] Use of commons-fileupload with OpenCMS 
> 
> 
> Sorry to bump a topic, but has anyone successfully used OpenCMS to 
> upload files via a MIME Multipart http post? Not necessarily using 
> fileupload? 
> 
> Thanks, 
> Ben 
> 
> Ben Rometsch wrote: 
> 
> > Hi There, 
> > 
> > I cannot get the jakarta-commons file-upload API to work under 
> > openCMS. 
> > 
> > http://jakarta.apache.org/commons/fileupload/
<http://jakarta.apache.org/commons/fileupload/>  
> > 
> > According to fileupload, the multi-part form request that 
> is generated 
> > by the browser when trying to upload a file contains NO name-value 
> > pairs. I have run identical code in a pure tomcat/jsp 
> environment and 
> > it works fine. 
> > 
> > Has anyone successfully used file-upload with OpenCMS? Or is there 
> > another standard way of handling multipart forms? 
> > 
> > Thanks, 
> > Ben 
> > 
> 
> -- 
> ----== Solid State Group ==---- 
> Web     www.solidstategroup.com 
> Email   ben at solidstategroup.com 
> MSN     benrometsch at hotmail.com 
> 
> _______________________________________________ 
> 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
<http://mail.opencms.org/mailman/listinfo/opencms-dev>  
> 
> 

_______________________________________________ 
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
<http://mail.opencms.org/mailman/listinfo/opencms-dev> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040318/911f228b/attachment.htm>


More information about the opencms-dev mailing list