How to download mp3 format file after clicking a tag in php html instead of opening it directly? Waiting online! _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:18:33
Original
2040 people have browsed it

Recently, due to project needs, I want to make a click-to-download function, which can be implemented with HTML. But the problem now is that if it is an mp3 file, then the click will use the system's built-in player to open it. If target=_blank is used , the mp3 file will be opened and played in the browser's default mode. I haven't found a good solution yet. The project is in urgent need and is about to go online. Please give me guidance! ! Extremely grateful!


Reply to discussion (solution)

Packaged into rar format. . .

Packaged into rar format. . .
1

Use php to output the downloaded file. Before outputting, set the response header Content-Disposition to attachment; filename="xxx.mp3" will do.

Directly connecting to the mp3 file will call System handler to open

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template