cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonas Höglund <jo...@swatdesign.com>
Subject mime type of uploaded documents
Date Mon, 12 Dec 2005 14:05:23 GMT
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

Mime
View raw message