Forums

cf7 find uploaded files in php

mayergreenberg259 05 Jan, 2024
I have a problem finding uploaded files in cf7.
When I used cf5, and uploaded a file in a form, I could get the file contents in php using $_FILES['file_input_name']["tmp_name"].
But now in cf7, the file doesn't seem to be there. The file does show up in components/com_chronoforms7/chronoforms/uploads.
My problem is that I dont know what the name of the file will be exactly. There is some form of timestamp appended to it, among other problems.
I don't want to have to search for which is the correct file.
Is there a way that I can get the exact path of the uploaded file in php?
I noticed that the exact path of the uploaded file is displayed in the forms debug info. Is there a way I can access that in php?
mayergreenberg259 12 Jan, 2024
Can someone please help me with this problem, I would like to find the name of the uploaded file on the server.
Thank you.
Max_admin 12 Jan, 2024
if you enable the form debug then it will show after the upload is done the name of the uploaded file along with other info like size and path
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mayergreenberg259 13 Jan, 2024
Yes, I know that.
I am looking to be able to get the file name in php in the 'Actions' section of the page. Is that possible?
Max_admin 14 Jan, 2024
$this->get("upload_action_name.path.to.file")


if you post the debug info I can tell you how to find the path
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mayergreenberg259 19 Jan, 2024
Sure here is the debug info:
Array
(
    [view] => form
    [chronoform] => UploadDocuments
    [gpage] => end_page
    [refNum] => 1
    [Description] => qwest
    [__cf_token] => f1439873-1360-4d77-a561-e49d7f072cfc
    [Document] => 20240119200144_raveisenmannwashington-march.pdf
)
Array
(
    [end_page_upload] => Array
        (
            [path] => /var/www/html/jdocs/components/com_chronoforms7/chronoforms/uploads/
            [Document] => Array
                (
                    [extensions] => Array
                        (
                            [0] => jpg
                            [1] => jpeg
                            [2] => png
                            [3] => gif
                            [4] => pdf
                            [5] => txt
                        )

                    [saved] => true
                )

            [var] => Array
                (
                    [Document] => Array
                        (
                            [path] => /var/www/html/jdocs/components/com_chronoforms7/chronoforms/uploads/20240119200144_raveisenmannwashington-march.pdf
                            [filename] => 20240119200144_raveisenmannwashington-march.pdf
                            [name] => Raveisenmannwashington_March.pdf
                            [size] => 360273
                            [url] => http://fakesitename.com/jdocs/load&dtask=download&file=20240119200144_raveisenmannwashington-march.pdf
                        )

                )

        )

    [end_page_validation] => Array
        (
            [log] => Automatic validation enabled.
            [var] => true
        )

    [php_7] => Array
        (
            [returned] => NULL
            [var] => NULL
        )

)


Can you tell me exactly what to put in the $this->get("")?
Max_admin 21 Jan, 2024
Answer
$this->get("Document.path") to get the uploaded file path in your case
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
mayergreenberg259 14 Feb, 2024
$this->get("Document.path") did not get me the name of the file.
$this->data("Document") did work though.
You need to login to be able to post a reply.