When I upload a file called "test.png", it gets saved
to uploadstest.png rather than uploads/test.png.
It is then of course not found when I try to access the
file.
===================
eric at themepark dot com
18-Jul-2002 11:15
note that realpath() will chop any trailing delimiter like \ or / ...don't forget to add it back on if you need it.
Eric Mueller - themepark.com
Now look at the code in getUploadFilePath() and notice that your "trailing slash" is inside the function call to realpath().
Please move the trailing slash to after the realpath() function call and people who don't explicitly configure UPLOAD_FILE_PATH or PHPWIKI_DIR will be unbroken again.
Actually, make that function take ANY of its possible inputs, call realpath on them and then append a slash. So much safer.
(even better, put an explicit slash after it on every use, then you're really safe against configuration mistakes)
Ta,
Bron.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=13755
Can you please tell me the version of lib/config.php and
the phpwiki release version (see lib/prepend.php).
getUploadFilePath() always has an ending slash.
Logged In: NO
Same issue here:
phpwiki: 1.3.12p3
lib/config.php: config.php,v 1.139 2006/03/19 14:50:42
Php: 5.1.2
Thanks,
Hinnerk
Logged In: YES
user_id=1546415
From config.php:
rcs_id('$Id: config.php,v 1.137 2005/08/06 14:31:10 rurban
Exp $');
From prepend.php:
define('PHPWIKI_VERSION', '1.3.12p2')
Logged In: YES
user_id=9941
Originator: NO
This just bit me as well, but I took the time to read the source code and find the bug.
The problem is with realpath().
http://php.net/realpath
In particular look at this comment:
===================
eric at themepark dot com
18-Jul-2002 11:15
note that realpath() will chop any trailing delimiter like \ or / ...don't forget to add it back on if you need it.
Eric Mueller - themepark.com
Now look at the code in getUploadFilePath() and notice that your "trailing slash" is inside the function call to realpath().
Please move the trailing slash to after the realpath() function call and people who don't explicitly configure UPLOAD_FILE_PATH or PHPWIKI_DIR will be unbroken again.
Actually, make that function take ANY of its possible inputs, call realpath on them and then append a slash. So much safer.
(even better, put an explicit slash after it on every use, then you're really safe against configuration mistakes)
Ta,
Bron.
Logged In: YES
user_id=13755
Originator: NO
Whow! Good catch!
This caught me also for a long time.
Will be fixed ASAP
Logged In: NO
Here's the solution, whoever maintains this:
edit line 101 in file lib/plugin/UpLoad.php to
$file_dir = getUploadFilePath().'/';
Cheers,
Luzi.