Forums

File name change when uploading

chriso0258 19 Sep, 2014
Hello,

I have a file upload action on my form. Works great except that after the file is uploaded, the file name is changed. For example, a file I uploaded is named J70130.pdf. After it is uploaded, the name is 20140919140304_J70130.pdf. Is there a way to upload the file with no name change?

Thanks.
Max_admin 20 Sep, 2014
This is done by default for security reasons, but we can add a new feature to control this by the next update!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 20 Sep, 2014
Hi chriso0258,

The string is actually a date-time string added to prevent uploads with the same name e.g. my-image.png conflicting with each other.

You could remove or change it with PHP in a Custom Code action if it's a current problem.

Bob
chriso0258 30 Oct, 2014
Hello Greyhead,

The debugger shows the following information on an uploaded file:

[_PLUGINS_] => Array
        (
            [upload_files] => Array
                (
                    [upload] => Array
                        (
                            [name] => 20141030111006_J70591 K41223.pdf
                            [original_name] => J70591 K41223.pdf


I guess I need to make name = original_name but I'm not sure how to write it out due to the many array structure.

Thanks for your assistance.
Max_admin 30 Oct, 2014
The latest update released yesterday has a new setting to control the file name, please check it!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
chriso0258 30 Oct, 2014
Thanks for your reply Max. I am using CF v4 and upgraded to 4.0.6. I don't see where there has been a change. Is the update only for v5?

Thanks.
Max_admin 30 Oct, 2014
Yes, the update I mentioned was the v5 one, but v4 had a setting to change this already, no ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
chriso0258 31 Oct, 2014
Hi Max,

I could not find such a setting in v4. In the action settings there is:

Enabled
fields configuration
upload path
Min/Max file size
Several text boxes for various errors
Safe file name (This will remove any special characters from the file name).
In the Advanced setting there is just "Array field".

Also, nothing in the Basic Setting under Preview.
chriso0258 31 Oct, 2014
Hi Bob,

I downloaded the action and installed. In the action it states,

Use {form_name} to use the file name alone - this may result in new uplaods over-writing existing files with the same name.
You may include other valid input values from the form as {input_name}



When I put in {form_name} the uploaded file is called equiptransfer.pdf. The actual file name is J70583 2013-04-09.pdf.
Here is the debug info:

Array
(
    [cid] => 110
    [task] => submit
    [Region] => Middle
    [Site] => CENTRAL OFFICE
    [Building] => asdf
    [Room] => asdf
    [date_moved] => 10-23-2014
    [upload] => equiptransfer.pdf
    [Notes] => asdf
    [submit] => Make change in ITS DB
    [equipinfo] => Array
        (
            [cf_id] => 110
            [region] => Middle
        )

    [cc_form_extension] => Array
        (
            [edit] => edit
        )

    [cc86bc7cf60355a6f5b0ccb8b03a43c7] => 1
    [user_id] => bi01d35_sa
    [date_created] => 10-31-2014
    [st_tag] => 110
    [upload_size] => 674
    [upload_url] => http://itsweb.chat.tenn/1801s/transfers/equiptransfer.pdf
    [upload_path] => /var/www/1801s/transfers/equiptransfer.pdf
    [_PLUGINS_] => Array
        (
            [upload_files] => Array
                (
                    [upload] => Array
                        (
                            [name] => equiptransfer.pdf
                            [path] => /var/www/1801s/transfers/equiptransfer.pdf
                            [size] => 690130
                            [link] => http://itsweb.chat.tenn/1801s/transfers/equiptransfer.pdf
                        )

                )

        )

    [_PLUGINS_upload_filesuploadname] => 
)

Validation Errors:

Array
(
)

Debug Data

    Upload files
        File post array: Array ( [name] => J70583 2013-04-09.pdf [type] => application/pdf [tmp_name] => /tmp/phphkiEMP [error] => 0 [size] => 690130 )
        Upload routine started for file upload by: upload
        Success: equiptransfer.pdf has been uploaded OK.
        File size is 674 kb
        File path is:
        /var/www/1801s/transfers/equiptransfer.pdf
        File url is:
        http://itsweb.chat.tenn/1801s/transfers/equiptransfer.pdf
GreyHead 03 Nov, 2014
Hi chriso0258,

Sorry, in my version here it says use {file_name} to to use the file name alone. As the name suggests {form_name} will use the name of the form :-(

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