You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jonas Höglund <jo...@swatdesign.com> on 2005/12/12 17:23:05 UTC
[SOLVED] Re: mime type of uploaded documents
My misstake. It was just me using the wron attribute name for the table
element. I accidentily used type instead of others-mode.
/j
<#>Jonas Höglund wrote:
> Hi,
>
> I'm want to use the modular database action for saving documents to a
> database. I allready uses it successfully for uploading images. I've
> managed to save the documents (any kind of binary file) to the
> database, but I can't figure out how to retrive the mimetype or the
> filename from the stream to save it to the db. Below is my code:
>
> -<root>
> <connection>stixyDB</connection>
> <table name="documents">
> <keys>
> <key name="id" type="int" autoincrement="true">
> <mode name="auto" type="autoincr" />
> </key>
> </keys>
> <values>
> <value name="file" type="binary">
> <mode name="raw-request-param" type="add" />
> </value>
> <value name="mimetype" type="string">
> <mode name="jxpath" type="add">
> <parameter>mimeType</parameter>
> <input-module name="raw-request-param"
> parameter="documents.file" />
> </mode>
> </value>
> <value name="filename" type="string">
> <mode name="jxpath" type="add">
> <parameter>fileName</parameter>
> <input-module name="raw-request-param"
> parameter="documents.file" />
> </mode>
> </value>
> </values>
> </table>
> <table-set name="document-table">
> <table name="documents" type="add" />
> </table-set> <#>
> </root> <#>
>
> This works when I'm uploading images. What's the difference? What am I
> doing wrong?
>
> The enctype attribute for the form is "multipart/form-data".
>
> Best,
> /jonas