cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Schneider" <volker.schnei...@danet.de>
Subject RE: enctype="multipart/form-data" problem
Date Tue, 12 Nov 2002 10:35:49 GMT
Hi myself,

this is a bug in MultipartParser.java in the readHeaders() method within
Cocoon 2.0.2.

When you define <form name="form2" enctype="multipart/form-data"
method="post"> and you use a <input name="uploadedfile" type="file"> field,
the header will contain:

...name="uploadedfile"; filename=""

When filename is empty the StringTokenizer in readHeaders() will have no
more tokens, but will get a nextToken() call.

Here's an approach for a bug fix:

...
while (tokenizer.hasMoreTokens())
{
  //---- old code
  //  headers.put(tokenizer.nextToken(" ;=\""),
  //          tokenizer.nextToken("=\""));

  //---- new code
  String key = tokenizer.nextToken(" ;=\"");
  String value = "";
  if (tokenizer.hasMoreTokens())
  {
    value = tokenizer.nextToken("=\"");
  }
  else
  {
    value = "";
  }

  headers.put(key, value);
  //---- end of new code
}

This helps unless the filename="" is not followed by an additional
attribute, but it helps for the moment.

Please fix this bug, if it is not done yet.

Best regards
- Volker -


-----Original Message-----
From: Volker Schneider [mailto:volker.schneider@danet.de]
Sent: Sonntag, 10. November 2002 22:32
To: cocoon-users@xml.apache.org
Subject: enctype="multipart/form-data" problem


Dear colleagues,

if have a form and I want to upload a file from that form. When I define my
form as

<form name="form2" enctype="multipart/form-data" method="post">

the ordinary input fields will not be transferred.

When I use method="get" it works. Unfortunately I have to use the "post"
method because I have to transfer a lot of data and I'm not sure, whether
this is possible with the "get" method (because of limited URL length).

Splitting the form is not possible, because I need the rest of the data too.

Please help me, what can I do?

Thank you, best regards
- Volker -


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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