Home Forums Community Forum Avada Forms File Upload – disable rename

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • tszdornbirn
    Participant
    Post count: 4

    Hello everyone,
    I would like to create a form for uploading files. The file name should be retained. Unfortunately Avada changes the file name to some letter combination after the upload. Can this automatic renaming be deactivated somehow?

    Michael C
    Keymaster
    Post count: 518

    Hi,

    We do have a filter for this mechanism. The first parameter is the unique filename, the second is the original filename. Adding something like the following to a child theme should return the original instead:

    add_filter( 'awb_forms_upload_file_name', 'original_file_name', 10, 2 );
    function original_file_name( $unique, $filename ) {
    	return $filename;
    }

    Please note though. Depending on what you are allowing to be uploaded this could prevent a security issue. Since the person uploading will know the filename as stored on the server.

    tszdornbirn
    Participant
    Post count: 4

    Hi,
    thanks for your answer.
    Unfortunately your code didn’t work.
    I put your code into the functions.php of my child theme, but the files are still being renamed.
    Do I have to change something somewhere else? Does it work with multi file upload?

    Michael C
    Keymaster
    Post count: 518

    Hi,

    Sorry about that, the filter will be available in 7.5, which hasn’t been released yet. It should be out soon though and then the code will work.

    Thanks

    tszdornbirn
    Participant
    Post count: 4

    Thanks, it worked!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.