Hi,

I think you should add

  <%@ page language="java" contentType="text/html; charset=utf-8" %>

at the absolute top of your page. And if that does not help, maybe

  <% response.setContentType("text/html; charset=utf-8"); %>

will help, but i think you won't need that last one.

---Andr�


At 14:25 +0200 24-09-2004, Paul van Beukering wrote:
Michiel,

You should take a look at e.g. the 'basic' jsp editors, which IIRC also
post multipart/form-data and
using them it should work fine. If that does work, I suggest you imitate
them..

I took /mmexamples/taglib/upload.jsp and added a text input field 'title'.
Then after upload I use this field as input for the title for the
attachment. see below

bij caf� bolle jan wordt dan bij caf? bolle jan.


<%@ taglib uri="http://www.mmbase.org/mmbase-taglib-1.0"; prefix="mm" %> <html> <head> <title>A simple http upload</title> <link href="style.css" rel="stylesheet" type="text/css"/> </head> <body> <%@ include file="menu.jsp"%> <mm:import externid="processupload">false</mm:import> <mm:cloud method="http">

  <h1>Example of how to upload a file into mmbase using taglibs</h1>
  <p>This page shows an example of how to upload an attachment into mmbase
    the page constist of two parts and depending on the processupload
paramteter
    one part of the document is shown
  </p>
  <%-- the form part --%>
  <mm:compare referid="processupload" value="false">
    <%-- create a html form  with method post and enctype multipart   --%>
    <form action="upload.jsp" method="post" enctype="multipart/form-data">
      <input type="hidden" name="processupload" value="true"/>
      title: <input type="title" name="title" value=""/><BR>
      <mm:fieldlist nodetype="attachments" fields="handle">
        Select the file you want to upload: <mm:fieldinfo type="input"/>
      </mm:fieldlist>
      <input type="submit"/>
    </form>
  </mm:compare>

  <%-- the process form part --%>
  <mm:compare referid="processupload" value="true">
   <%-- a bit of a hack --%>
    <mm:import externid="_handle_name" from="multipart"/>
    <mm:import externid="_handle_type" from="multipart"/>
    <mm:import externid="_handle_size" from="multipart"/>
    <mm:import externid="title" from="multipart" />
    <%-- create a node of type attachments --%>
    <mm:createnode type="attachments" id="attachment">
      <mm:setfield name="title"><mm:write referid="title"/></mm:setfield>
      <mm:setfield name="filename"><mm:write
referid="_handle_name"/></mm:setfield>
      <mm:setfield name="mimetype"><mm:write
referid="_handle_type"/></mm:setfield>
      <mm:setfield name="size"><mm:write
referid="_handle_size"/></mm:setfield>
      <mm:fieldlist fields="handle">
         <mm:fieldinfo type="useinput" />
      </mm:fieldlist>
    </mm:createnode>

    <%-- show some info --%>
    <mm:node referid="attachment">
        number <mm:field name="number"/><br/>
        title <mm:field name="title"/><br/>
        mimetype <mm:field name="mimetype"/><br/>
        size <mm:field name="size"/><br/>
        gui <mm:field name="gui()"/><br/>
    </mm:node>
  </mm:compare>
</mm:cloud>


----- Original Message ----- From: "Michiel Meeuwissen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 23, 2004 5:53 PM Subject: Re: enctype="multipart/form-data" forms


 Paul van Beukering wrote:
 >    Have a problem with enctype forms
 >    In a form, with enctype="multipart/form-data" I upload multiple files
and
 >    text variables.
 >    The problem is the character encoding. Characters outside the ascii
range
 >    become '?'
 >    Anybody familiar with an enctype supporting both needs?

The issue is rather complicated. IIUC, you should assume that the
characters are received encoded
 according to the same encoding as the page which did the post.

You could also use the CharacterEncodingFilter to add a encoding to the
request, but I don' think it
 is essential.

You might also be hit by bug #6569, but I have not the faintest idea how
your implementation does
 look like.

You should take a look at e.g. the 'basic' jsp editors, which IIRC also
post multipart/form-data and
using them it should work fine. If that does work, I suggest you imitate
them..

Anyhow, the problem is not the 'enctype'.


Michiel


-- Michiel Meeuwissen mihxil' Mediacentrum 140 H'sum [] () +31 (0)35 6772979 nl_NL eo_XX en_US






--

------------------------------------------------------------------>><<--
Andr� van Toly
http://www.toly.nl
06-27233562



Reply via email to