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 <[EMAIL PROTECTED]>/* 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: [EMAIL PROTECTED]
     > For additional commands, e-mail: [EMAIL PROTECTED]
     >
     >
    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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to