I coded a upload component to use with flowscript
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24529
see the explanation
There is a error in the package name , use this :
<?xml version="1.0" encoding="UTF-8"?>
<role-list>
<role name="org.apache.cocoon.components.UploadManager"
shorthand="upload_manager"
default-class="org.apache.cocoon.components.UploadManagerImpl"/>
</role-list>
> Hi Sylvain ... I post the code I'm using... Tell me what you think about
it
> ...
>
> import java.io.File;
> import java.io.FileInputStream;
> import java.util.Map;
> import org.apache.avalon.framework.logger.AbstractLogEnabled;
> import org.apache.avalon.framework.parameters.Parameters;
> import org.apache.avalon.framework.thread.ThreadSafe;
> import org.apache.cocoon.acting.Action;
> import org.apache.cocoon.environment.ObjectModelHelper;
> import org.apache.cocoon.environment.Redirector;
> import org.apache.cocoon.environment.Request;
> import org.apache.cocoon.environment.SourceResolver;
> import org.apache.cocoon.servlet.multipart.Part;
> import org.apache.cocoon.servlet.multipart.PartOnDisk;
>
> public class FileUploadAction
> extends AbstractLogEnabled
> implements Action, ThreadSafe {
>
> public Map act(Redirector redirector, SourceResolver resolver,
> Map objectModel, String source,
> Parameters par) throws Exception {
>
> Request request = ObjectModelHelper.getRequest(objectModel);
>
> Part filePart = (PartOnDisk) request.get("uploadfile");
>
> if (filePart != null) {
>
> getLogger().debug("Uploaded file = " + filePart.getFileName());
>
> } else {
>
> getLogger().debug("File not found");
>
> }
>
> return java.util.Collections.EMPTY_MAP;
>
> }
>
> }
>
>
> In sitemap:
>
> <map:actions>
> <map:action name="fileupload" src="edu.uoc.riudavets.FileUploadAction"/>
> </map:actions>
>
> Pipeline:
>
> <map:pipeline>
> <map:match pattern="upload">
> <map:act type="fileupload">
> <map:generate src="XML/success.xml"/>
> <map:transform src="XSL/success.xsl"/>
> <map:serialize type="html"/>
> </map:act>
> <map:generate src="XML/fail.xml"/>
> <map:transform src="XSL/fail.xsl"/>
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
>
> Form:
>
> <form name="f1" action="upload" method="post">
> <input type="file" name="uploadfile"/>
> <input type="submit" value="Upload"/>
> </form>
>
>
> I have been trying to make it works during some weeks .. I don't know what
> more I can do !!!!
>
> Please, some help !!! <:-(
>
>
>
> ----- Original Message -----
> From: "Sylvain Wallez" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, November 10, 2003 5:34 PM
> Subject: Re: Is it possible to upload files with Cocoon 2.1???
>
>
> > Josep Riudavets wrote:
> >
> > >Thanks for your soon answer ...
> > >
> > >I have tried all wiki examples, my web.xml is well configured. The
> problem is that there is not a exact code for Cocoon 2.1. Could you post
the
> exact action code you're using?
> > >
> > >
> >
> > public Map act(... Map objectModel ...) {
> > Request request = ObjectModelHelper.getRequest(objectModel);
> > Part part = (Part)request.get("upload-input");
> > InputStream stream = part.getInputStream();
> >
> > // use stream here...
> > }
> >
> > Sylvain
> >
> > --
> > Sylvain Wallez Anyware Technologies
> > http://www.apache.org/~sylvain http://www.anyware-tech.com
> > { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
> > Orixo, the opensource XML business alliance - http://www.orixo.com
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]