Html Code To Create Download Link

It depends of your browser settings and plugins however if you are using php you can do a script to download the file like this one: file = $_GET['file']; if (file_exists($file) && is_readable($file) && preg_match('/.mp3$/',$file)) { header('Content-type: application/mp3');. HTML Colors; HTML Images; This article explains how to create a link from one page to another. It also outlines the different types of hyperlinks. Links, otherwise known as hyperlinks, are defined using the tag — otherwise known as the anchor element. To create a hyperlink, you use the tag in conjunction with the href attribute.

i have html file with video and audio file. and i want to links file such as mp3 or mp4 using tag a href and download that file. My video and audio file stored in same folder with my html file.

i have tried this code :

but not downloaded my file, just open a new tab with a play pause controls in the center.

from this question i get to add 'download' to my href tag, but it is for modern browser. How about for old browser?

how i can create a download link for my video/audio in html file and support for all browser (not only for modern browser)?


thanks in advance and sorry for my bad English.

Community
Yohanes AIYohanes AI

2 Answers

It depends of your browser settings and plugins however if you are using php you can do a script to download the file like this one:

File

save it as download.php

Html Code To Create Download Link

then create a link like this one

It should work now, have a nice day.

ELavicountELavicount

You can try this. I've tried it, and it's working for me.

Emir DupovacEmir Dupovac

Not the answer you're looking for? Browse other questions tagged htmlaudiovideobrowserhref or ask your own question.

Categories: Downloading

In other languages:

Español: hacer que un archivo se pueda descargar desde tu página web, Italiano: Rendere un File Scaricabile sul tuo Sito Web, Português: Disponibilizar um Arquivo para Download em seu Website, Deutsch: Eine Datei von deiner Webseite herunterladbar machen, Русский: создать файл, который можно скачать с вашей веб страницы, Français: proposer un fichier à télécharger sur son site Internet, Bahasa Indonesia: Membuat Berkas Dapat Diunduh dari Situs Pribadi, Nederlands: Een downloadlink maken op je website, العربية: إتاحة ملف للتنزيل في موقعك الإلكتروني, ไทย: ทำให้ดาวน์โหลดไฟล์จากเว็บของคุณได้, Tiếng Việt: Tạo liên kết tải về cho tập tin trên trang web, 中文: 在你的网站上提供文件供下载

  • Print
  • Edit
  • Send fan mail to authors