Seite 1 von 1

Downloaddialog erzwingen beim Flowload Modul

Verfasst: Sa 29. Mär 2008, 18:40
von winston
Hallo!

Ich habe mir das Downloadmodul flowload eingerichtet,
allerdings möchte ich es hauptsächlich für mp3 downloads nutzen.
Problem dabei ist, dass beim Download die Dateien im Browser abgespielt werden.

Ich möchte also praktisch den Downloaddialog erzwingen

Vielen dank schonmal

Verfasst: Sa 29. Mär 2008, 19:45
von tono
Kannst Du das Modul umschreiben? Hier ein allgemeiner Hinweis für PHP:
http://www.html.de/tutorials/12090-php- ... ingen.html

Verfasst: Sa 29. Mär 2008, 20:04
von i-fekt
Dann stell den Force-Type um.

Verfasst: Sa 29. Mär 2008, 21:18
von winston
so! ich habe es hinbekommen :) ist bestimmt nicht perfekt und eine abfrage des dateitypen wäre evtl sinnvoll, aber es funktioniert für meine zwecke!

vielen dank:

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname   :     flowload 1.0 counter / redirecter
* Author(s)   :     flow, jessix[at]gmx.net
* Edited by   :     Winston
* Created     :     29.03.2008
*
************************************************/

if(!isset($_GET['fid'])) exit;

// Db qry
$sql = "SELECT dirname, filename, dl_count FROM ".$cfg['tab']['upl']." WHERE idupl = '".trim($_GET['fid'])."'";
$db->query($sql);
$db->next_record();
$count = ($db->f('dl_count'))+1;
$dirname = $db->f('dirname');
$filename = $db->f('filename');

//if(!$db->f('filename')) exit;

$sql = "UPDATE ".$cfg['tab']['upl']." SET dl_count = '".$count."' WHERE idupl ='".$_GET['fid']."' LIMIT 1";
$db->query($sql);

$db->free();
//header("Location: upload/".$dirname.$filename);
$Datei = "upload/".$dirname.$filename;
$Dateiname = basename($Datei);
$Größe = filesize($Datei);
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=$Dateiname");
header("Content-Length: $Größe");
readfile($Datei);

?>