Ich möchte Datein zum downloaden anbieten. Das Downloadfenster kommt auch aber wenn ich die Datei dann downloade ist nur der Qeulltext der Webseite in der Datei und nicht der eiegntliche Inhalt.
Code:
public function makeDownload($file, $dir)
{
$dir = str_replace("@", "/", $dir);
$dir .= "/";
if(file_exists($dir.$file) && strstr($dir, "downloads"))
{
$filesize = filesize($dir.$file);
$type = $this->getType($file);
header("Content-Type: $type");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Content-Length: $filesize");
readfile("./downloads/ordner 1/test1.txt/");
}
}