Hi all,
I need to upload powerpoint files to remote PCS using cocoon XSP
framework.
So for that i had a HTML page as  follows:
<form method="post" enctype="multipart/form-data" name="sayHello"
action="">
       <input type="file" name="uploadfile" size="25"/></td>
</form>
And i update web.xml file as follows:
---------------------------------------------------
<init-param>
      <param-name>upload-directory</param-name>
      <param-value>WEB-INF/work/upload-dir</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>   

And the entry in sitemap.xmp file 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="">
     <map:parameter name="use-request-parameters" value="true"/>
   </map:transform>
   <map:transform src=""/>
   <map:transform type="sunShine"/>
   <map:call resource="skinit">
     <map:parameter name="type" value="document2html" />
   </map:call>
</map:act>
   </map:match>

When i select the file from browse button and submit the request .able
to upload the files to upload-dir. But i need to capture the file
object and store that in someother location or in remote pc (which also
contains cocoon framework running on that machine).

The code in my XSP as follows
----------------------------------------------

<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>javax.servlet.http.HttpServletRequest</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);
 
  Enumeration enum=request.getAttributeNames();
  while(enum.hasMoreElements())
  {
  System.out.println(" 1.. "+enum.nextElement());
  } 
  System.out.println("1"+request.get("uploadfile"));
        FilePartFile filePart = (FilePartFile)
request.get("uploadfile");
  System.out.println("2"+filePart);
 
        //File file = ((FilePartFile)filePart).getFile();
        System.out.println("3");
     System.out.println("3"+filePart.getFilePath());
        //System.out.println("file name:  "+file.getCanonicalPath());

 
      <status>File...uploaded</status>
</xsp:logic>
</uploadFile001>
</xsp:page>


but here i am unable to capture the   FilePartFile from request object.
    FilePartFile filePart = (FilePartFile) request.get("uploadfile");
     Is this statement right?
Help will be appreciated.


Thanks
Joshua


Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

Reply via email to