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 eigentliche Inhalt.
PHP-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-Length: $filesize");
//header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file\"");
readfile($dir.$file);
}
}
Ich hoffe mir kann hier einer helfen
Einen Kommentar schreiben: