- Home
- Categorie
- Coding e Sistemistica
- Coding
- rendere scaricabile un linkl con mp3
-
rendere scaricabile un linkl con mp3
Ciao a tutti!
se io metto un normalissimo link per un file mp3 ```
<a href="file.mp3" target="_blank">ciao</a>si apre il player integrato nel browser... io vorrei invece che si scaricasse il file e ti chiedesse "salva con nome" ... Come posso fare ?
-
Credo bisogni prima identificare se ti puoi appoggiare ad un linguaggio server, php o asp?
-
uso php...
-
Prova a vedere se questo post ti puo essere di aiuto, per riadattarlo alle tue esigenze...
http://www.giorgiotave.it/forum/php-mysql/81361-esportazione-dati-da-mysql-word.html#post504182
-
Grazie!!
-
Magari se arrivi al giusto risultato postalo qua cosi puo essere di aiuto ad altri utenti.

-
Ecco quello che ho trovato! è a mio avviso la soluzione più semplice!
[PHP]
<?php
// Output buffer to file
$path ='http://';if(isset($_GET['file'])){
$saveas=$_GET['file'];}
ob_start();
// Query your database and print your content here
print('This is test content!');// Stop buffer; Only print the buffer var below here and nothing else!
$buffer=ob_get_contents();
ob_end_clean();header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Transfer-Encoding: binary ");
header('Content-Type: application/force-download');
header("Content-Type: application/download");
header('Content-Length: '.strlen($buffer));
header('Content-Disposition: attachment; filename="'.$path.$saveas.'"');echo $buffer;
?>[/PHP]
Sinceramente tutte le opzioni non so bene che significato abbiano ma il metodo funziona!