bajji m wrote:

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>
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>
<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>


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



Hello,


1.) Did you set enable-uploads to true in web.xml?
2.) To receive an PartOnDisk-Object you have to set "autosave-upload" to true in web.xml. Else you will get an object of type PartInMemory.
3.) Why do you use FilePartFile? What is it? Use (Part), PartOnDisk or PartInMemory instead.
4.) Did you set a form with attributes enctype and action like this?
<form action="foo" enctype="multipart/form-data" method="POST">
...
</form>
5.) Have you seen the wiki docs about this subject?
http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadsWithCocoon2.1


Hope, this helps.

Regards
Stephan



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to