Whenever I download a file with spaces in its name from apolyton, it truncates all of the name after the first space and puts no extension to the name.
So when I download:
Blaha of the Romans 221 B.C.sav
then this will be downloaded to: Blaha and I manually have to add the ".sav" extension.
I have developed some php code that will do around this (mainly by replacing spaces with underscores).
Probably Markos could hack something like this into the forum?
Don't ask me why it puts an extra linebreak in every line...
Probably another thing Markos could quick-fix
So when I download:
Blaha of the Romans 221 B.C.sav
then this will be downloaded to: Blaha and I manually have to add the ".sav" extension.
I have developed some php code that will do around this (mainly by replacing spaces with underscores).
Probably Markos could hack something like this into the forum?
PHP Code:
<?php
$wFile = $_GET["file"];
if (!$wFile) exit;
$fname = $_SERVER["DOCUMENT_ROOT"]."/".$wFile;
preg_match("/.*(\..*)$/", $fname, $fname_ext);
switch($fname_ext)
{
case ".jpg":
$content_type = "image/jpeg";
break;
case ".zip":
$content_type = "application/zip";
break;
case ".sav":
$content_type = "application/savegame";
break;
default:
$content_type = "";
}
$file = fopen($fname,"rb"); // open image for reading
if (!$file)
{
echo "Error: File does not exist";
exit;
}
$fsize = filesize($fname);
if ($content_type != "")
header("Content-Type: ".$content_type);
if (preg_match("#Firefox#i",$_SERVER["HTTP_USER_AGENT"]))
{
$wFile = str_replace(" ","_",$wFile);
}
header("Content-Disposition: attachment; filename=".$wFile);
header("Content-Length: ".$fsize);
fpassthru($file);
fclose($file)
?>
Probably another thing Markos could quick-fix
Comment