You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by bajji m <jo...@yahoo.com> on 2004/01/07 10:48:31 UTC
File Upload using cocoon. Unable to catch FilePartFile object from request object
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
Re: File Upload using cocoon. Unable to catch FilePartFile object from request object
Posted by bajji m <jo...@yahoo.com>.
Hi Geoff,
Thanks for help. Now i am using action class for file uploading .now i am able to invoke that action class and uploaded to some diffrrent directory using file.renameTo(File) method... But now i need to upload this file to some other PC which contains this cocoon framework runnin on that machine. How can i do that?
Now what i am doing i am invoking that xsp logic as webserivice from my action class by giving WSDL url with that method name.. In this action class i am adding this file object to session. So in that XSP logic and trying to get that file object from session.
But iam getting null value of File object. How can i do this?
Is it possibe to invoke some different action class that running on different PC with cocoon from this action fileupload class.?
pls help me.
thanks
bajji
Geoff Howard <co...@leverageweb.com> wrote:
1) in your sitemap below, I don't see where you are calling the xsp. As
far as I can see it's not running at all.
2) I'd really recommend _not_ using an xsp generator to do business
logic (like saving an uploaded file). If you're stuck in 2.0x use an
action (which can also be coded using xsp though i've never done it
personally). If you can move to 2.1 (which I would consider a must for
any new development) use flow.
3) In your xsp below you only have to do a file.renameTo() to move the
file - does that not get what you want?
Geoff
bajji m wrote:
> Hi Stephan,
>
> Thanks for info. pls have a look at my code as follows
>
> web.xml
> ------------
>
>
upload-directory
>
E:\upfiles
>
>
>
>
autosave-uploads
>
true
>
>
>
>
>
overwrite-uploads
>
rename
>
>
>
>
>
upload-max-size
>
10000000
>
> i put autosave-uploads true also.
>
> HTML form
> ---------------
>
> > action="fileUpload.html">
> File: [input]
> [input]
>
>
> And sitemap.xmap entry as follows
> --------------------------------------------------
>
>
>
>
> > value="http://localhost:8080/ssfsoap/services/VideoproService?wsdl"/>
>
>
>
> > src="content/xdocs/services/xsl/fileUploadResult2Html.xsl">
>
>
>
>
>
>
>
>
>
>
> And my XSP:
> ----------------------
>
>
> > xmlns:xsp="http://apache.org/xsp">
>
> -->
>
> java.io.File
> java.util.Enumeration
> java.util.Collections
> java.util.Map
> org.apache.cocoon.environment.*
>
> org.apache.cocoon.components.request.multipart.*
>
>
>
> Request request = ObjectModelHelper.getRequest(objectModel);
> System.out.println("1"+request);
> FilePart filePart = (FilePart) request.get("uploadfile");
> System.out.println("2"+filePart);
> File file = ((FilePartFile)filePart).getFile();
> System.out.println("2"+file.getCanonicalPath());
> //getLogger().debug("Uploaded file = " + file.getCanonicalPath());
> File...uploaded
>
>
>
> But here my problem is the file was succssfully uploaded to the
> uploaded-dir ( E:\uploadfile\) which i gave in web.xml file. But i
> need to store that file into dynamically created directory name based on
> the user who uploads that file. so i want to catch that File object from
> the FilePartFile object from the request object.
>
> But my doubt is according to wikki they are cathing that file object in
> action class. But i am invoking or catching in XSP file. Is this request
> object comes to XSP page with file object? pls clarify me?
>
> Pls look my sitemap.xmap entry and all files. pls let me know where i am
> doing wrong.
>
>
> Thanks
> bajji
>
>
> */Stephan Coboos /* wrote:
>
> Stephan Coboos wrote:
>
> > bajji m wrote:
> >
> >> Hi Stephan,
> >> Thanks for help.
> >> But i am using cocoon 2.0 version. So i do't have enable-uploads
> tag
> >> in my web.xml file.
> >> So according to wikki document on cocoon 2.0 i followed that
> >> document steps.
> >> i thibk this enable-upload tag was in 2.1 version. so let me the
> >> further steps pls.
> >> so how can i proceed it? pls help me?
> >>
> >> Regards
> >> bajji
> >>
> > OK. In 2.0 I had not used uploads but let me see your HTML-Form
> and I
> > hope I can help you.
> >
> > Did you take a look into your log files?
> >
> > Regards
> > Stephan
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> Next try:
>
> Have you tried autosave-uploads=true?
> Form the wiki-docs about the action example:
> *"Examples* See FileUploadWithAction
> for an
> action which retrieves a FilePartFile object by name from the request
> (requires autosave-uploads=true) ..."
>
> Regards
> Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
Re: File Upload using cocoon. Unable to catch FilePartFile object
from request object
Posted by Geoff Howard <co...@leverageweb.com>.
1) in your sitemap below, I don't see where you are calling the xsp. As
far as I can see it's not running at all.
2) I'd really recommend _not_ using an xsp generator to do business
logic (like saving an uploaded file). If you're stuck in 2.0x use an
action (which can also be coded using xsp though i've never done it
personally). If you can move to 2.1 (which I would consider a must for
any new development) use flow.
3) In your xsp below you only have to do a file.renameTo() to move the
file - does that not get what you want?
Geoff
bajji m wrote:
> Hi Stephan,
>
> Thanks for info. pls have a look at my code as follows
>
> web.xml
> ------------
> <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>true</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>
> i put autosave-uploads true also.
>
> HTML form
> ---------------
>
> <form method="post" enctype="multipart/form-data" name="sayHello"
> action="fileUpload.html">
> <b>File:</b><input type="file" name="uploadfile" size="25"/> </tr>
> <input type="submit" value="Upload" name="button" />
> </form>
>
> And sitemap.xmap entry as follows
> --------------------------------------------------
> <map:match pattern="body-*/fileUpload.xml">
> <map:act type="sunRise-auth">
> <map:parameter name="handler" value="videopro-handler"/>
> <map:generate type="wapi">
> <map:parameter name="wsdlURL" type="String"
> value="http://localhost:8080/ssfsoap/services/VideoproService?wsdl"/>
> <map:parameter name="methodName" type="String" value="uploadFile001" />
> <map:parameter name="secure" type="String" value="false" />
> </map:generate>
> <map:transform
> src="content/xdocs/services/xsl/fileUploadResult2Html.xsl">
> <map:parameter name="use-request-parameters" value="true"/>
> </map:transform>
> <map:transform src="content/xdocs/session2html.xsl"/>
> <map:transform type="sunShine"/>
> <map:call resource="skinit">
> <map:parameter name="type" value="document2html" />
> </map:call>
> </map:act>
> </map:match>
>
> And my XSP:
> ----------------------
>
> <?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);
> FilePart filePart = (FilePart) request.get("uploadfile");
> System.out.println("2"+filePart);
> File file = ((FilePartFile)filePart).getFile();
> System.out.println("2"+file.getCanonicalPath());
> //getLogger().debug("Uploaded file = " + file.getCanonicalPath());
> <status>File...uploaded</status>
> </xsp:logic>
> </uploadFile001>
> </xsp:page>
> But here my problem is the file was succssfully uploaded to the
> uploaded-dir ( E:\uploadfile\) which i gave in web.xml file. But i
> need to store that file into dynamically created directory name based on
> the user who uploads that file. so i want to catch that File object from
> the FilePartFile object from the request object.
>
> But my doubt is according to wikki they are cathing that file object in
> action class. But i am invoking or catching in XSP file. Is this request
> object comes to XSP page with file object? pls clarify me?
>
> Pls look my sitemap.xmap entry and all files. pls let me know where i am
> doing wrong.
>
>
> Thanks
> bajji
>
>
> */Stephan Coboos <cr...@gmx.net>/* wrote:
>
> Stephan Coboos wrote:
>
> > bajji m wrote:
> >
> >> Hi Stephan,
> >> Thanks for help.
> >> But i am using cocoon 2.0 version. So i do't have enable-uploads
> tag
> >> in my web.xml file.
> >> So according to wikki document on cocoon 2.0 i followed that
> >> document steps.
> >> i thibk this enable-upload tag was in 2.1 version. so let me the
> >> further steps pls.
> >> so how can i proceed it? pls help me?
> >>
> >> Regards
> >> bajji
> >>
> > OK. In 2.0 I had not used uploads but let me see your HTML-Form
> and I
> > hope I can help you.
> >
> > Did you take a look into your log files?
> >
> > Regards
> > Stephan
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> Next try:
>
> Have you tried autosave-uploads=true?
> Form the wiki-docs about the action example:
> *"Examples* See FileUploadWithAction
> for an
> action which retrieves a FilePartFile object by name from the request
> (requires autosave-uploads=true) ..."
>
> Regards
> Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: File Upload using cocoon. Unable to catch FilePartFile object from request object
Posted by bajji m <jo...@yahoo.com>.
Hi Stephan,
Thanks for info. pls have a look at my code as follows
web.xml
------------
<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>true</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>
i put autosave-uploads true also.
HTML form
---------------
<form method="post" enctype="multipart/form-data" name="sayHello" action="fileUpload.html">
<b>File:</b><input type="file" name="uploadfile" size="25"/> </tr>
<input type="submit" value="Upload" name="button" />
</form>
And sitemap.xmap entry as follows
--------------------------------------------------
<map:match pattern="body-*/fileUpload.xml">
<map:act type="sunRise-auth">
<map:parameter name="handler" value="videopro-handler"/>
<map:generate type="wapi">
<map:parameter name="wsdlURL" type="String" value="http://localhost:8080/ssfsoap/services/VideoproService?wsdl"/>
<map:parameter name="methodName" type="String" value="uploadFile001" />
<map:parameter name="secure" type="String" value="false" />
</map:generate>
<map:transform src="content/xdocs/services/xsl/fileUploadResult2Html.xsl">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:transform src="content/xdocs/session2html.xsl"/>
<map:transform type="sunShine"/>
<map:call resource="skinit">
<map:parameter name="type" value="document2html" />
</map:call>
</map:act>
</map:match>
And my XSP:
----------------------
<?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);
FilePart filePart = (FilePart) request.get("uploadfile");
System.out.println("2"+filePart);
File file = ((FilePartFile)filePart).getFile();
System.out.println("2"+file.getCanonicalPath());
//getLogger().debug("Uploaded file = " + file.getCanonicalPath());
<status>File...uploaded</status>
</xsp:logic>
</uploadFile001>
</xsp:page>
But here my problem is the file was succssfully uploaded to the uploaded-dir ( E:\uploadfile\) which i gave in web.xml file. But i need to store that file into dynamically created directory name based on the user who uploads that file. so i want to catch that File object from the FilePartFile object from the request object.
But my doubt is according to wikki they are cathing that file object in action class. But i am invoking or catching in XSP file. Is this request object comes to XSP page with file object? pls clarify me?
Pls look my sitemap.xmap entry and all files. pls let me know where i am doing wrong.
Thanks
bajji
Stephan Coboos <cr...@gmx.net> wrote:
Stephan Coboos wrote:
> bajji m wrote:
>
>> Hi Stephan,
>> Thanks for help.
>> But i am using cocoon 2.0 version. So i do't have enable-uploads tag
>> in my web.xml file.
>> So according to wikki document on cocoon 2.0 i followed that
>> document steps.
>> i thibk this enable-upload tag was in 2.1 version. so let me the
>> further steps pls.
>> so how can i proceed it? pls help me?
>>
>> Regards
>> bajji
>>
> OK. In 2.0 I had not used uploads but let me see your HTML-Form and I
> hope I can help you.
>
> Did you take a look into your log files?
>
> Regards
> Stephan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
Next try:
Have you tried autosave-uploads=true?
Form the wiki-docs about the action example:
*"Examples* See FileUploadWithAction
for an
action which retrieves a FilePartFile object by name from the request
(requires autosave-uploads=true) ..."
Regards
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
Re: File Upload using cocoon. Unable to catch FilePartFile object
from request object
Posted by Stephan Coboos <cr...@gmx.net>.
Stephan Coboos wrote:
> bajji m wrote:
>
>> Hi Stephan,
>> Thanks for help.
>> But i am using cocoon 2.0 version. So i do't have enable-uploads tag
>> in my web.xml file.
>> So according to wikki document on cocoon 2.0 i followed that
>> document steps.
>> i thibk this enable-upload tag was in 2.1 version. so let me the
>> further steps pls.
>> so how can i proceed it? pls help me?
>>
>> Regards
>> bajji
>>
> OK. In 2.0 I had not used uploads but let me see your HTML-Form and I
> hope I can help you.
>
> Did you take a look into your log files?
>
> Regards
> Stephan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
Next try:
Have you tried autosave-uploads=true?
Form the wiki-docs about the action example:
*"Examples* See FileUploadWithAction
<http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadWithAction> for an
action which retrieves a FilePartFile object by name from the request
(requires autosave-uploads=true) ..."
Regards
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: File Upload using cocoon. Unable to catch FilePartFile object
from request object
Posted by Stephan Coboos <cr...@gmx.net>.
bajji m wrote:
>Hi Stephan,
>Thanks for help.
>But i am using cocoon 2.0 version. So i do't have enable-uploads tag in my web.xml file.
>So according to wikki document on cocoon 2.0 i followed that document steps.
>i thibk this enable-upload tag was in 2.1 version. so let me the further steps pls.
>so how can i proceed it? pls help me?
>
>Regards
>bajji
>
OK. In 2.0 I had not used uploads but let me see your HTML-Form and I
hope I can help you.
Did you take a look into your log files?
Regards
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: File Upload using cocoon. Unable to catch FilePartFile object from request object
Posted by bajji m <jo...@yahoo.com>.
Hi Stephan,
Thanks for help.
But i am using cocoon 2.0 version. So i do't have enable-uploads tag in my web.xml file.
So according to wikki document on cocoon 2.0 i followed that document steps.
i thibk this enable-upload tag was in 2.1 version. so let me the further steps pls.
so how can i proceed it? pls help me?
Regards
bajji
Stephan Coboos <cr...@gmx.net> wrote:
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:
>---------------------------------------------------------
>
>
upload-directory
>
E:\upfiles
>
>
>
>
autosave-uploads
>
false
>
>
>
>
>
overwrite-uploads
>
rename
>
>
>
>
upload-max-size
>
10000000
>
>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:
>-------------------------------
>
>> xmlns:xsp="http://apache.org/xsp">
> xmlns:xsp-request="http://apache.org/xsp/request/2.0">
>
>
> java.io.File
> java.util.Enumeration
> java.util.Collections
> java.util.Map
> org.apache.cocoon.environment.*
> org.apache.cocoon.components.request.multipart.*
>
>
>
> //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());
>
> File...uploaded
>
>
>
>
>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?
...
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
Re: File Upload using cocoon. Unable to catch FilePartFile object
from request object
Posted by Stephan Coboos <cr...@gmx.net>.
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org