Forums

File Upload Path to DB

weeezdom 05 Dec, 2012
Hi,
my form contains some input fields and a file upload that works just fine. it´s set to upload any image to my web server.
the form inputs are saved to a database.
the problem now is that only the image ´s file name is saved to DB, but not the file path.

the chronoform_data array sends [image] => 20121205092340_imagename.jpg to the data base, but what i would need is the path info:

 [_PLUGINS_] => Array
        (
            [upload_files] => Array
                (
                    [image] => Array
                        (
                            [name] => 20121205092340_imagename.jpg
                            [original_name] => imagename.jpg
                            [path] => /home/web/images/20121205092340_imagename.jpg
                            [size] => 5238
                            [link] => http://www.url.com/images/20121205092340_imageFox.jpg
                        )



Do you know how to get "/home/web/images/20121205092340_imagename.jpg" saved to data base?
thanks
GreyHead 05 Dec, 2012
Hi weezdom,

There are various ways, the simplest is probably to add a Custom Code action just before the DB Save action and add:
<?php
$form->data['image'] = $form->data['_PLUGINS_']['upload_files']['image']['path'];
?>

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