Posts: 3
Threads: 1
Joined: Sep 2011
Reputation:
0
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?
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
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
Posts: 3
Threads: 1
Joined: Sep 2011
Reputation:
0
Hi Ben,
v 2.0.6
original filename = winterpainting.jpg .
Thanks for your help.
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Sep 10th, 2011, 8:33 AM
(This post was last modified: Sep 10th, 2011, 8:33 AM by Ben.)
Hi mrdan,
Would you mind trying this? Add this line to your /global/config.php file:
PHP Code:
<?php
$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