cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bajji m <joshua_...@yahoo.com>
Subject Re: File Upload using cocoon. Unable to catch FilePartFile object from request object
Date Fri, 09 Jan 2004 07:02:55 GMT
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 <cocoon@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
Mime
View raw message