You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "blick@fmi.uni-passau.de" <bl...@fmi.uni-passau.de> on 2003/09/25 10:58:54 UTC

different upload-dirs for different applications

Hi,

I have 2 applications accessing one cocoon (using different paths of
course). Both apps need to upload Files. Is there any way to make cocoon
save the incoming files in different directorys?

I have seen the single-Directory solution but that does not fit my needs. 

Any help is highly appreciated!

peter


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: different upload-dirs for different applications

Posted by Jorg Heymans <jh...@domek.be>.
you need to create an action that has some logic in it which determines 
the application trying to save the file (eg make the applications pass a 
unique parameter in the request or so)

 From the wiki 
(http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadWithAction)

    public Map act(Redirector redirector, SourceResolver resolver,
                   Map objectModel, String source, Parameters par)
        throws Exception
    {
	//use the request object below to get the additional request parameter
        Request request = ObjectModelHelper.getRequest(objectModel);
        FilePart filePart = (FilePart) request.get("uploaded_file");

        File file = ((FilePartFile)filePart).getFile();	
        getLogger().debug("Uploaded file = " + file.getCanonicalPath());
        // here you can open an InputStream on the file or whatever
        // you may also want to delete the file after using it
        return Collections.EMPTY_MAP;

    }

action can be defined in the sitemap as following
    <map:actions>
      <map:action name="upload-files" src="your.action.package.class"
                          logger="my.logger.filestore"/>
    </map:actions>     

<map:pipelines>
......
        <map:act type="upload-files">
              <map:generate type="request"/>
        </map:act>


blick@fmi.uni-passau.de wrote:

>Hi,
>
>I have 2 applications accessing one cocoon (using different paths of
>course). Both apps need to upload Files. Is there any way to make cocoon
>save the incoming files in different directorys?
>
>I have seen the single-Directory solution but that does not fit my needs. 
>
>Any help is highly appreciated!
>
>peter
>
>
>--------------------------------------------------------------------
>mail2web - Check your email from the web at
>http://mail2web.com/ .
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org