when uploading a file named "something.another.zip" it will give an error saying ".another.zip" is not an acceptable extension.
and if the name is "something.another.alsoanother.zip" it will consider the extension as ".another.alsoanother.zip"
Of course you know you would be better off using an underscore instead of a period to name your files until Bloc comes up with a solution.
In TPdlmanager.php ...
uses this:
// check the extension
$allowed=explode(',',$context['TPortal']['dl_allowed_types']);
$dlext=substr(strstr($name, '.'),1);
if(!in_array($dlext, $allowed)){
$status='wrongtype';
unlink($_FILES['tp_dluploadfile']['tmp_name']);
$error = $txt['tp-dlexterror'].':<b> <br />'.$context['TPortal']['dl_allowed_types'].'</b><br /><br />'.$txt['tp-dlexterror2'].': <b>'.$dlext.'</b>';
fatal_error($error);
}
Fel
A woman that knows how to code.... what a turn on! :-* :D
;D
I'm a codewoman IchBin :coolsmiley:
Try to replace
$dlext=substr(strstr($name, '.'),1);
with
$dlext=substr(strrchr($name, '.'),1);
..in dlmanager.php.
That will be very complex ;)
If you try the last dot (strrchr), myfile.tar.gz not work .. ::)
Fel
ah..darn, i forgot. :) Ok, scratch that, I need to find a better way.
maybe you could use regular expressions to compare the end of the name with the allowed types:
"(\.zip|\.txt|\.exe|\.tar\.gz|\.rar)$ ";
$allowed=explode(',',$context['TPortal']['dl_allowed_types']);
$pattern="(.".$allowed[0];
foreach($allowed as $ext)
$pattern.="|.".$ext;
$pattern.=")$ ";
$pattern = str_replace(".", "\.", $pattern);
if (!eregi($pattern, $name)){
$status='wrongtype';
unlink($_FILES['tp_dluploadfile']['tmp_name']);
$error = $txt['tp-dlexterror'].':<b> <br />'.$context['TPortal']['dl_allowed_types'].'</b><br /><br />'.$txt['tp-dlexterror2'].': <b>'.$dlext.'</b>';
fatal_error($error);
}
not sure about this though.
Yes..but the idea was to allow any type to be displayed, so the user knows what the script interprets it as.
I think in fact keeping it will be better. If it complains you will then quickly see that it do not like dots in the name.