The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
File upload filename - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17) +--- Thread: File upload filename (/showthread.php?tid=1606) |
File upload filename - mrdan - Sep 8th, 2011 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? RE: File upload filename - Ben - Sep 8th, 2011 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 RE: File upload filename - mrdan - Sep 8th, 2011 Hi Ben, v 2.0.6 original filename = winterpainting.jpg . Thanks for your help. RE: File upload filename - Ben - Sep 10th, 2011 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 RE: File upload filename - mrdan - Sep 10th, 2011 That did the trick!! Thanks so much for your excellent support! RE: File upload filename - Ben - Sep 14th, 2011 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 RE: File upload filename - Kfrix - Sep 23rd, 2011 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. Kathryn |