cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lionel Crine <cr...@4dconcept.fr>
Subject Re: use an http attribute in an action
Date Mon, 16 Jun 2003 10:11:54 GMT
Here is what I did from a post (input type="file"). I don't know if this 
that you need!!



this is the upload of an illustration :

Request request = ObjectModelHelper.getRequest(objectModel);
Enumeration e = request.getParameterNames();

while (e.hasMoreElements()) {
String param = (String) e.nextElement();
Object value = request.get(param);


//get the name of the document
String fileName = null;
if (value instanceof FilePart) {
fileName = ((FilePart) value).getFileName();
}

//get the content from the post
if (value instanceof FilePartArray) {
FilePartArray fpa = (FilePartArray) value;
InputStream is = fpa.getInputStream();
int size = is.available();
byte[] b = new byte[size];
try {
is.read(b);
}
finally {
is.close();
}

....

Lionel




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


Mime
View raw message