[opencms-dev] UPLOAD FILES

Campione Aldo aldo.campione at siemens.com
Mon Apr 19 10:26:02 CEST 2004


Please can anybody help me ??
 
I use the following code to upload a file and it works fine .......
<% 
... 
    
  Enumeration e = cms.getRequestContext().getRequest().getFileNames();
  while (e.hasMoreElements()) {
          String  name = (String)e.nextElement();
           byte[] sourceByteArray =
cms.getRequestContext().getRequest().getFile(name);
           String  destFileName= "usr/share/uploads/  + name;
           File nomefile=new File(destFileName);
           FileOutputStream outFileStream=new
java.io.FileOutputStream(nomefile);
           outFileStream.write(sourceByteArray);
  }
 ...
%> 
 
.... but if i try yo upload a big file (more than 17MB) it returns a
java.lang.outOfMemoryError
 
 
2004-04-16 18:49:56 StandardWrapperValve[OpenCmsServlet]: Servlet.service()
for servlet OpenCmsServlet threw exception
javax.servlet.ServletException: Servlet execution threw an exception
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:269)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:392)
 at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:619)
 at java.lang.Thread.run(Thread.java:534)
----- Root Cause -----
java.lang.OutOfMemoryError

 
Thank You
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040419/5f8077a6/attachment.htm>


More information about the opencms-dev mailing list