Hi everybody,
I am getting into some issues in File uploading part using cocoon framework.
I made changes to web.xml file like this:
---------------------------------------------------------
<init-param>
<param-name>upload-directory</param-name>
<param-value>E:\upfiles</param-value>
</init-param>
<init-param>
<param-name>autosave-uploads</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>overwrite-uploads</param-name>
<param-value>rename</param-value>
</init-param>
<init-param>
<param-name>upload-max-size</param-name>
<param-value>10000000</param-value>
</init-param>
<param-name>upload-directory</param-name>
<param-value>E:\upfiles</param-value>
</init-param>
<init-param>
<param-name>autosave-uploads</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>overwrite-uploads</param-name>
<param-value>rename</param-value>
</init-param>
<init-param>
<param-name>upload-max-size</param-name>
<param-value>10000000</param-value>
</init-param>
So when i submit a request from html with form elemens the selected file was successfully uploaded to my uploaded dir. But i am trying to catch FilePartFile object in XSP from request object. But here i am getting null value for FilePartFile object.
My xsp looks like this:
-------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp">
xmlns:xsp-request="http://apache.org/xsp/request/2.0">
<xsp:structure>
<xsp:include>java.io.File</xsp:include>
<xsp:include>java.util.Enumeration</xsp:include>
<xsp:include>java.util.Collections</xsp:include>
<xsp:include>java.util.Map</xsp:include>
<xsp:include>org.apache.cocoon.environment.*</xsp:include>
<xsp:include>org.apache.cocoon.components.request.multipart.*</xsp:include>
</xsp:structure>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp">
xmlns:xsp-request="http://apache.org/xsp/request/2.0">
<xsp:structure>
<xsp:include>java.io.File</xsp:include>
<xsp:include>java.util.Enumeration</xsp:include>
<xsp:include>java.util.Collections</xsp:include>
<xsp:include>java.util.Map</xsp:include>
<xsp:include>org.apache.cocoon.environment.*</xsp:include>
<xsp:include>org.apache.cocoon.components.request.multipart.*</xsp:include>
</xsp:structure>
<uploadFile001>
<xsp:logic>
//Request request = ObjectModelHelper.getRequest(objectModel);
System.out.println("1"+request);
System.out.println("1"+request.get("uploadfile"));
FilePartFile filePart = (FilePartFile) request.get("uploadfile");
System.out.println("2");
File file = ((FilePartFile)filePart).getFile();
System.out.println("3");
stem.out.println("3"+filePart.getFilePath());
System.out.println("file name: "+file.getCanonicalPath());
<status>File...uploaded</status>
</xsp:logic>
</uploadFile001>
</xsp:page>
<xsp:logic>
//Request request = ObjectModelHelper.getRequest(objectModel);
System.out.println("1"+request);
System.out.println("1"+request.get("uploadfile"));
FilePartFile filePart = (FilePartFile) request.get("uploadfile");
System.out.println("2");
File file = ((FilePartFile)filePart).getFile();
System.out.println("3");
stem.out.println("3"+filePart.getFilePath());
System.out.println("file name: "+file.getCanonicalPath());
<status>File...uploaded</status>
</xsp:logic>
</uploadFile001>
</xsp:page>
I am unable to catch FilePartFile object from request object.
Pls help me. pls let me know where i am doing wrong.
Thanks
Joshua
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
