take a look here

http://wiki.cocoondev.org/Wiki.jsp?page=RecipeUploadUsingAction

it working 




On Thu, 4 Mar 2004, Zamek wrote:

> Hello All,
> 
> I try to use upload with xsp.
> Sample is working well, and I try to move uploaded file to my path.
> 
> here is my xsp (based upload.xsp):
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <!-- CVS $Id: upload.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
> 
> <xsp:page language="java"
>           xmlns:xsp="http://apache.org/xsp";
>           xmlns:xsp-request="http://apache.org/xsp/request/2.0";
>           xmlns:xsp-response="http://apache.org/xsp/response/2.0";
>           xmlns:log="http://apache.org/xsp/log/2.0";>
> 
>   <xsp:structure>
>    
> <xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
>    <xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
>    <xsp:include>java.io.File</xsp:include>
>    <xsp:include>org.apache.cocoon.environment.*</xsp:include>
>    <xsp:include>org.apache.cocoon.components.request.multipart.*</xsp:include>
>   </xsp:structure>
> 
>   <xsp:logic>
> version 1.
>     String filename=request.getParameter("upload-file");  
> 
> here I am get an error: java.lang.NullPointerException 
> It is ok, because there is no upload-file parameter, but I have to handle 
> empty parameters.
> 
> and then I try to test it:
> 
> version 2.
>     if (request.getParameter("upload-file") != null) {
>        String filename=request.getParameter("upload-file");  
>     }
> 
> Once more error:
> // end error String filename=request.getParameter("upload-file"); } File 
> uploadDir = null; ... Line 76, column 0: Syntax error on keyword "if"; 
> "boolean", "void", "byte", "short", "int", "long", "char", "float", 
> "double", "Identifier", "interface", "class" expected
> I don't know what is it, but another try:
> 
> version 3.
>    String filename=<xsp:request-parameter name="upload-file"/>;
> 
> and another error:
> . Line 77, column 0: Syntax error on token ";", "{", "+", "-", "--", "++", 
> "boolean", "void", "byte", "short", "int", "long", "char", "float", 
> "double", "(", "true", "false", "IntegerLiteral", "LongLiteral", 
> "FloatingPointLiteral", "DoubleLiteral", "CharacterLiteral", 
> "StringLiteral", "null", "~", "!", "super", "this", "new", "Identifier" 
> expected
> 
> 
>     File uploadDir = null;
>     /** Contextualize this class */
>     public void contextualize(Context context) throws ContextException {
>       uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR);
>     }
>   </xsp:logic>
> 
> 
> So can anybody send me a working xsp which is move uploaded file to any 
> path?
> 
> 


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

Reply via email to