Downloaden van (mp3)bestanden
Op mijn site, van een koor, heb ik de moeglijkheid om muziekstukken voor de koorleden te laten downloaden. In mijn geval zijn dit mp3-bestanden.
De bedoeling is dat als een koorlid op een plaatje klikt, hij/zij het bestand automatisch gaat downloaden.
Met de code die ik nu gebruik wordt het mp3-bestandje afgespeeld. Ook leuk, maar was niet de bedoeling.
Wie kan/wil mij een suggestie aan de hand doen met welke php-instructie ik het bestand kan downloaden. De optie van het klikken met de rechtermuisknop wil ik eigenlijk niet hanteren. Mijn voorkeur gaat uit naar twee plaatjes, een voor het afluisteren en een voor het downloaden.
De huidige, gebruikte, code is:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php $cX = ""; ?>
<?php while($row=mysql_fetch_array($result)){ ?>
<?php $cFile = $row['bestand'];
$cFile = "http://www.cco-harderwijk.nl/login/catalogus/".trim(strip_tags($cFile));
$cX = '<a '.'href="'.$cFile.'">'.'<img alt="Links klikken = luisteren, rechts klikken = opslaan" longdesc="Links klikken = luisteren, rechts klikken = opslaan" src="media/download.jpg" border="0" style="float: left" /></a>';
?>
<tr>
<td nowrap="100px" width="150px" class="content"><?php echo $cX ; ?></td>
<td nowrap="200px" width="200px" class="content"><?php echo $row['titel'] ; ?></td>
<td nowrap="200px" width="200px" class="content"><?php echo $row['componist'] ; ?></td>
<td nowrap="200px" width="200px" class="content"><?php echo $row['arrangeur'] ; ?></td>
<td nowrap="150px" width="150px" class="content"><?php echo $row['partij'] ; ?></td>
</tr>
<?php $cX = $cY; ?>
<?php } ?>
<?php while($row=mysql_fetch_array($result)){ ?>
<?php $cFile = $row['bestand'];
$cFile = "http://www.cco-harderwijk.nl/login/catalogus/".trim(strip_tags($cFile));
$cX = '<a '.'href="'.$cFile.'">'.'<img alt="Links klikken = luisteren, rechts klikken = opslaan" longdesc="Links klikken = luisteren, rechts klikken = opslaan" src="media/download.jpg" border="0" style="float: left" /></a>';
?>
<tr>
<td nowrap="100px" width="150px" class="content"><?php echo $cX ; ?></td>
<td nowrap="200px" width="200px" class="content"><?php echo $row['titel'] ; ?></td>
<td nowrap="200px" width="200px" class="content"><?php echo $row['componist'] ; ?></td>
<td nowrap="200px" width="200px" class="content"><?php echo $row['arrangeur'] ; ?></td>
<td nowrap="150px" width="150px" class="content"><?php echo $row['partij'] ; ?></td>
</tr>
<?php $cX = $cY; ?>
<?php } ?>
Code (php)
php.net, je moet hem alleen aanpassen aan je eigen bestand.