MultiUpload file link on database

Save multi-upload file links to a database in ChronoForms.

Overview

The issue occurs because the custom code incorrectly references the file data array structure.
Access single file links directly from the files array and use indexed keys for multiple uploads to correctly store each file link.

Answered
li livingwebstudio 04 Dec, 2015
Hi,
I have a simple form with a multiupload file
I need to save in DB the link of each file thah I upload.
I have this debug
Array
(
    [articolo] => Array
        (
            [name] => 23_Errori_dmb.docx
            [original_name] => Errori_dmb.docx
            [path] => articoli/201512040927_645_23/23_Errori_dmb.docx
            [size] => 13536
            [link] => articoli/201512040927_645_23/23_Errori_dmb.docx
        )

    [foto] => Array
        (
            [0] => Array
                (
                    [name] => 23_dmb_contatti.png
                    [original_name] => dmb_contatti.png
                    [path] => articoli/201512040927_645_23/23_dmb_contatti.png
                    [size] => 36176
                    [link] => articoli/201512040927_645_23/23_dmb_contatti.png
                )

        )

)

Uploaded one file "articolo" and two file "foto"

I used this custom code for "Articolo" but it doesn't work..
<?php
$form->data['articolo_url'] = $form->data['_PLUGINS_']['articolo']['link'];
?>


How can I solve??😟
Gr GreyHead 04 Dec, 2015
Answer
1 Likes
Hi livingwebstudio,

Please try
<?php
$form->data['articolo_url'] = $form->files['foto'][0]['articolo']['link'];
?>

Bob
li livingwebstudio 04 Dec, 2015
1 Likes
Hi GreyHead,
this code works fine for the
<?php
$form->data['articolo_url'] = $form->files['articolo']['link'];
?>

and this code works for multiple upload
$form->data['file0_url'] = $form->files['foto']['0']['link'];
$form->data['file1_url'] = $form->files['foto']['1']['link'];

thanks
This topic is locked and no more replies can be posted.