The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File upload filename
I have a multi-page form where one of the fields is for an image upload. It works fine except the filename is file.jpg, 1_file.jpg, 2_file.jpg, etc. Can it be set up so the filename is actually the name of the file being uploaded, preceded by 1_, 2_, etc, for duplicate names instead of formtools forcing the filename to be "file", or am I doing something wrong causing the filename to be lost?
Hi mrdan,

Welcome to the forums!

Couple of questions: what version of the Core are you using? And what was the original filename of the file being uploaded?

- Ben
Hi Ben,

v 2.0.6

original filename = winterpainting.jpg .

Thanks for your help.
Hi mrdan,

Would you mind trying this? Add this line to your /global/config.php file:

PHP Code:
$g_filename_char_whitelist "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"

For some reason, the code can't find that variable in the file upload code, so it doesn't think that ANY character is valid - which is why it defaults to the "file" filename fallback.

This would imply that when you upgraded at one point, all the files weren't uploaded to the site... but let's see if this fixes it and we'll go from there!

- Ben
That did the trick!!

Thanks so much for your excellent support!
Interesting....! I'm very glad it worked, but would you mind taking a look at your /global/library.php file? It sounds like maybe that file wasn't upgraded properly. At the top of the file, what version does it say Form Tools is?

That file *should* contain that variable you just added to your config.php file.

- Ben
I have exactly the same problem! I'm adding that line to my config file now. I looked at my library.php file, and the version is @version 2.0.6 * @package 2-0-6

In library.php the line is there, but has a slight difference, a dash after the underscore before the numbers
My Formtools is version 2.0.6

Thanks for this fix, I have applied it, and it worked.


Forum Jump:

Users browsing this thread: 1 Guest(s)