files => array" i got some other CodeArray( [pdf_inserat] => Array ( [name] => 20160309075615_hexdata1.1.0.pdf [original_name] => hexdata1.1.0.pdf [path] => M:\xamppserver\xampp_17_ifma\htdocs\17_02_ifma\components\com_chronoforms5\chronoforms\uploads\meldeform_intern_02_stellenboerse\20160309075615_hexdata1.1.0.pdf [size] => 843065 [link] => http://localhost/17_02_ifma/components/com_chronoforms5/chronoforms/uploads/meldeform_intern_02_stellenboerse/20160309075615_hexdata1.1.0.pdf ))Tahnk you"> Write a dwonload link in a db - Forums

Forums

Write a dwonload link in a db

galbur 09 Mar, 2016
Hi

I just want to build a little form with an upload field.
The path with the Dwonloadlink should be written in the DB.

I tried to do it like described here:

http://www.chronoengine.com/faqs/53-cfv4/cfv4-file-uploads/2681-how-can-i-link-to-an-uploaded-file.html

But insteaed of "$form->files => array" i got some other Code

Array
(
    [pdf_inserat] => Array
        (
            [name] => 20160309075615_hexdata1.1.0.pdf
            [original_name] => hexdata1.1.0.pdf
            [path] => M:\xamppserver\xampp_17_ifma\htdocs\17_02_ifma\components\com_chronoforms5\chronoforms\uploads\meldeform_intern_02_stellenboerse\20160309075615_hexdata1.1.0.pdf
            [size] => 843065
            [link] => http://localhost/17_02_ifma/components/com_chronoforms5/chronoforms/uploads/meldeform_intern_02_stellenboerse/20160309075615_hexdata1.1.0.pdf
        )

)


Tahnk you
GreyHead 09 Mar, 2016
Hi galbur,

That is the contents of the $form->files array. You want to copy the [Please post a link to the form so I can take a quick look. entry to the $form->data array so that it can be saved.

Are you sure that you need to save the URL? Usually just the file name (and perhaps a folder name) is enough as you can always re-build the URL or path from that data.

Bob
GreyHead 09 Mar, 2016
Hi galbur,

In a Custom Code action after the Files Upload action and before the DB Save action add code like this
<?php
$form->data['file_link'] = $form->files['pdf_inserat']['link'];
?>

Replace 'file_link' with the name of the table column where you want to save the link.

Bob
galbur 09 Mar, 2016
Hi Bob

Perfect! Thank you...

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