Hi, everybody,

I want to upload a file into my database. I want to upload it by my own action. I followed several examples for file uploads in cocoon for example: http://wiki.apache.org/cocoon/FileUploadWithAction and followed this thread http://www.mail-archive.com/[email protected]/msg41160.html .

My code in the act method of my action look as follows:

Request  request = (Request)ObjectModelHelper.getRequest(objectModel);
System.out.println(request.get("picture"));
Part filePart = (Part) request.get("picture");

I get a class cast exception in the third line: "java.lang.ClassCastException: java.lang.String". request.get("picture"); returns a String. How can I get a Part object? The filename is printed out correctly in line 2.

This is my html:

<html>
....
<form method="get" action="someaction">
.....

<form enctype="multipart/form-data" method="post" 
action="/webapp-1.0/switch/severalparameters">
<input type="file" name="picture"><input class="button" value="Upload" name="submit" 
type="submit">
</form>
....

</form>
....
</html>

I would be happy if anyone can help.

cheers
Johannes


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

Reply via email to