Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Upload fie without store them one the database

$
0
0
Hi everyone,
i'm trying to handle file upload with smartclient and i'd like to store uploaded file one the file system avoiding the use of datasource binary field.
I'm stuck beacause i get null from this method in my DMI.
Code:

dsRequest.getUploadedFiles()
This is the form code:
Code:

isc.DynamicForm.create({
    ID:"formCaricamentoImmagini",
    dataSource:WEB_IMMAGINE,
    fields: [
        {title:"Selezionare immagini", name: "IMMAGINE", multiple:true, type: "imageFile", hint: "Dimensione Massima 5 MB", required: true },
        { title: "Salva", type: "button", startRow:false,endRow:false,
            click: function () {
                this.form.saveData(function(){

                    },
                    {operationId:"uploadImmagine"});
            }
        }
    ]

});

This is WEB_IMMAGINE datasource XML file
Code:

<DataSource
        dbName="admin"
        tableName="web_immagine"
        ID="WEB_IMMAGINE"
    dropExtraFields="false"
        serverType="sql"
>
        <fields>
                <field implicitSequence="true" primaryKey="true" name="ID_IMMAGINE" type="sequence"></field>
                <field name="PATH_IMG" length="255" type="text"></field>
                <field name="PATH_THUMB" length="255" type="text"></field>
        </fields>
    <operationBindings>
        <operationBinding operationType="add" operationId="uploadImmagine" serverMethod="uploadImmagine">
            <serverObject lookupStyle="spring" bean="immagineDMI"/>
        </operationBinding>
        <operationBinding operationType="fetch" operationId="selectMaxId">
            <customSQL>
                SELECT MAX(ID_IMMAGINE) AS IDM FROM web_immagine;
            </customSQL>
        </operationBinding>
    </operationBindings>
</DataSource>

in this case i get the null error mentioned above but i can get the file stream by using <getUploadedField("IMMAGINE")>, the problem is that IMMAGINE field contains multiple file to upload and i can only get the stream of the first one.

If instead i add the IMMAGINE(and related _filename, _fileSize, ecc fields) field in the XML datasource file all works fine except that i need to add 3 useless field on the database.

What am i missing ?

thanks

1. SmartClient v9.1 PowerEdition Trial

2. Chrome 37

Viewing all articles
Browse latest Browse all 4756