Forums

[SOLVED] GH File Upload Action - save image link in table

momentis 10 Dec, 2012
Using the GH File Upload action:

I have a field in my database where I would like to store a link to the file uploaded with form submission. When I add a debug action in the On Submit event, I can see the following array:

    [_PLUGINS_] => Array
        (
            [upload_files] => Array
                (
                    [regpeople_photo] => Array
                        (
                            [name] => User1-photo.jpg
                            [path] =>  /home/REDACTED/images/registration_uploads/momentis/Stoffiere-Richard-photo.jpg
                            [size] => 775702
                            [link] =>  REDACTED/registration_uploads/momentis/Stoffiere-Richard-photo.jpg
                        )

                )

        )


I have a field named 'regpeople_image' where I wish to store the value of the link in the above array. Is this possible?

Thanks!
Rick
momentis 10 Dec, 2012
Again, I jumped the gun! Got it to work. I realized, from the debug info, that I could get the value of the URL field by using:

$form->data['regpeople_photo_url']


Then I could use this to save to the field in the database.

Sorry!!! 😶
Rick
GreyHead 10 Dec, 2012
Hi Rick,

Are you sure that output is from the Upload Files [GH] action? It looks the standard Upload Files action. As you worked out $form->data['regpeople_photo_url'] has what you want.

Bob
momentis 10 Dec, 2012
Yes, sorry, that was from the standard upload action, which I was using BEFORE I remembered to use the one you developed. The code worked for your action as well!

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