Hi Geoff....

I have been trying to develope a system to upload a file to cocoon (I'm
using cocoon 2.1) ... but I have not achieved it !!!

I need some help, because I don't understant wiki explanation. I know flow
is not very easy to implement ... but can it be done with an action?

Could somebody explain me more about uploading files in Cocoon 2.1 ????

Thanks a lot ...


----- Original Message -----
From: "Geoff Howard" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 15, 2003 1:52 AM
Subject: Re: Uploading fiiles: flow function


> Josep Riudavets Aguilo wrote:
>
> > Hi all ...
> >
> > I'm delevoping some code in Cocoon 2.1 in order to upload files.
> >
> > I have added these lines into my XSL page:
> >
> >  <form action="/upload" method="POST" enctype="multipart/form-data">
> >      <input type="file" name="blah"/>
> >      <input type="submit" name="action" value="Upload"/>
> >     </form>
> >
> > Next, I have added this code into the sitemap.xmap:
> >
> >    <map:match pattern="/upload">
> >     <map:call function="upload"/>
> >    </map:match>
> >
> > Now ... I have to write next function:
> >
> >    var role = Packages.org.mystuff.UploadManager.ROLE;
> >
> >    function upload() {
> >       var uploader = cocoon.componentManager.getComponent(role);
> >       var part = cocoon.request.get("blah");
> >       var success = uploader.handle(part.getInputStream());
> >       if (success) {
> > sendPage("success.html");
> >       } else {
> > sendPage("failure.html");
> >       }
> >    }
> >
> > But I don't know where to write this function !!! Is is a javascript
> > function???
> >
> > (all info is from
> > http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadsWithFlow)
>
> It's flowscript which, yes, is implemented in Cocoon using the
> javascript core from the Rhino project.  You'll need to read up at least
> a little on the wiki about flow before making much sense of this.  That
> was an example snippet, not a cut-and-paste ready solution.
>
> For instance, it presupposes that you have a component written and
> deployed in Cocoon called org.mystuff.UploadManager and you also have a
> pipeline which matches "success.html" and "failure.html".  oh, and it
> presupposes that org.mystuff.UploadManager has a public method
> handle(InputStream is).
>
> I think this is going to be so common that it would probably deserve to
> be in the core at least in a simple form.  I'll see if I can make some
> time for it.  This is really pretty easy and would be a good simple
> patch for someone who is interested.  I'd be happy to help out.
>
> Geoff
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>



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

Reply via email to