cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <>
Subject Upgrading the "Upload File" sample to handle binary formats
Date Thu, 02 Sep 2004 06:24:07 GMT
I am sure this is an easy task for someone
who knows what they are doing (i.e. not me) 

In the "Upload File" sample, only text is handled
and the code looks like:

function handleUpload(form) {
  var buf = new java.lang.StringBuffer();
  var uploadWidget = form.lookupWidget("upload");
  if (uploadWidget.getValue() != null) {
    var stream = uploadWidget.getValue().getInputStream();
    var reader = new;
    var line;
    while ((line=reader.readLine())!=null)
  return buf.toString();

It seems it should be possible to upgrade this to 
write out binary...???  Specifically, I want users to
be able to upload standard image files - JPEG, GIF
and PNG (and maybe BMP).   The ideal solution would
only allow these files types, but this is less critical than
simply being able to get binary uploaded in the first 

Any help appreciated... if the solution works, maybe
I can post it to the Wiki for future reference.


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message