Forums

File Extension

rafaelscouto 15 Feb, 2019
Hello
I have a field of upload of several media formats: audio, video and image.

I know how to create the file name in a custom way, but I can not generate the extensions (.jpeg, .mp3, .mp4) according to what is sent.

When saving the file is only with the name without the extension
healyhatman 15 Feb, 2019
It says how right there in the File name provider field.
​

If not empty then the resulting value will used as the file name, you can use {var:FN.file.name} and {var:FN.file.extension} to get the file name and extension.

rafaelscouto 18 Feb, 2019
I understand, but ...

If I save this mode Ex: {var: FN.file.jpeg}

When I upload an .mp3 file at the time of saving, it will save as .jpeg

What I want is to customize the file name, this I know how to do, and save according to the file extension.
healyhatman 18 Feb, 2019
No, you literally write the word "extension". And replace FN with the name of your file upload action
rafaelscouto 19 Feb, 2019
I'm probably doing something wrong, check the images and debug please.
Array
(
    [upload4] => Array
        (
            [path] => /var/www/html/campoformoso.ba.gov.br/web/apps/images/midia_ouvidoria/
            [file1] => Array
                (
                    [extensions] => Array
                        (
                            [0] => jpg
                            [1] => jpeg
                            [2] => png
                            [3] => mp3
                            [4] => mp4
                        )

                    [saved] => 1
                )

            [var] => Array
                (
                    [file1] => Array
                        (
                            [path] => /var/www/html/campoformoso.ba.gov.br/web/apps/images/midia_ouvidoria/20190219
                            [filename] => 20190219
                            [name] => modelo_imagem.png
                            [size] => 33137
                        )

                )

        )

    [save_data6] => Array
        (
            [data] => Array
                (
                    [created] => 2019-02-19 11:59:57
                    [user_id] => 816
                    [file1] => 20190219
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `syscf_z_ouvidoria-cadastrar` (`created`, `file1`)  values  ('2019-02-19 11:59:57', '20190219');
                )

            [var] => Array
                (
                    [created] => 2019-02-19 11:59:57
                    [file1] => 20190219
                    [aid] => 159
                )

        )

)
healyhatman 19 Feb, 2019
Here's an example.
{var:upload4.file.name}_{date:dmY}.{var:upload4.file.extension}
Elita- 20 Feb, 2019
Hello, healyhatman, rafaelscouto,
Sorry for intrusion, but I have one question regarding the same topic:
​
This is the working code I sucesfully implemented for file uploads:
{data:Name}_{data:Surname}_{var:upload3.file.name}.{var:upload3.file.extension}
​
Now I need to do this for
Repeater file uploads, where Fieldname for the field "Name" would be Person[{var:area_repeater38.key}][Name]
​
Any suggestions?
healyhatman 20 Feb, 2019
Honestly given the way the file upload action currently works, I can't imagine how to go about doing that.
Elita- 20 Feb, 2019
but it is not😟 working. the result is like this - if the filename would be photo.jpg, then uploaded filename is __photo.jpg where 2 underscores are the underscores in the code between {data:Name}_{data:Surname}_{var:upload3.file.name}.{var:upload3.file.extension}
healyhatman 20 Feb, 2019
Uh huh like I said I don't know how to do it.
Elita- 20 Feb, 2019
found your bug report here -
https://www.chronoengine.com/forums/posts/t105593/various-bugs-upload-files-repeaters
​
in the debug section there i found this:
[0] => loop_event25.key}]:txt
I got the same when i put {data:Name[{var:area_repeater38.key}]} in the code
​
like this -
[0] => ]}_]}_eedd36377572b11f649ca44c4c66d8cc.jpg
did you get the answer on this?
healyhatman 20 Feb, 2019
Nope. Asked the dev about it, I'll let you know.
rafaelscouto 20 Feb, 2019
Thank you very much, solved my problem.
Max_admin 25 Feb, 2019
Hello,
​
The repeater got some updates and the feature in question should work fine with the next update!
​
Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.