On Tuesday 14 October 2003 03:14 pm, S.A. de Heer wrote:
> Hello People,
Hi, 

the jsp editor and the jsp taglibs still use the old HttpPost and but don't use the
filename and mimetype that is send in the multipart form.
attached is an example that "might" work for you 
it uses <mm:import externid="_handle_name" from="multipart"/>
and <mm:import externid="_hande_type" from="multipart"/>
to later store the values in the newly created node.

(in mmbase 1.7 that first didn't work because is was not possible to get non byte[] 
fields from the multipart form)

in each case in your code in the setfield method you shoud list only the handle and 
not all fields
      <mm:fieldlist type="all" fields="handle">
         <mm:fieldinfo type="useinput" />
      </mm:fieldlist>

greetings
> 
> A repost since nobody noticed the previous one ;) I have a problem with
> attachments they end up in the database without a filename. Anybody a clue?
> This is  the form that uploads the file:
> 
> <FORM action="post.jsp" method="post" enctype="multipart/form-data">
> <mm:fieldlist nodetype="attachments" fields="handle">
>  <mm:fieldinfo type="input"/>
> </mm:fieldlist>
>  <input class="knop" type="submit" name="submit" value="Opslaan"/>
> 
> I did remove all other input fields and text.
> 
> The input is after that processed in this code:
>    <mm:createnode type="attachments" id="linkje">
>    <mm:fieldlist type="all" >
>     <mm:fieldinfo type="useinput" />
>    </mm:fieldlist>
>    <mm:setfield name="title"><mm:write referid="naam"/></mm:setfield>
>    <mm:setfield name="description"><mm:write
> referid="beschrijving"/></mm:setfield>
>   </mm:createnode>
> 
> Greetings,
> 
> 
> Sjoerd de Heer
> 
> 

-- 
Kees Jongenburger
Mediapark C101 Hilversum  
+31 (0)35 6772910
Title: A simple http upload
<%@ taglib uri="http://www.mmbase.org/mmbase-taglib-1.0" prefix="mm" %> <%@ include file="menu.jsp"%> false

Example of how to upload a file into mmbase using taglibs

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

<%-- the form part --%> <%-- create a html form with method post and enctype multipart --%> Select the file you want to upload: <%-- the process form part --%> <%-- a bit of a hack --%> <%-- create a node of type attachments --%> <%-- show some info --%> number
title
mimetype
size
gui

Reply via email to