LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-05-2008, 07:55 PM   #1
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Rep: Reputation: 30
Apache 2 - how to set mp3 to download not play in browser


Hey all,
Have apache2 running on RHEL4 and trying to insert links to download mp3s. All i do is <A HREF="song.mp3">DOWNLOAD</A> but when i click on the link, the mp3 plays in the browser. I want to be able to download it.
(possibly have the ability to have a link to download, and a link to play)

Do I need to add something to httpd.conf?
Thanks all.
 
Old 02-06-2008, 01:22 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Isn't this something you set on the client side?

My browser decides what it does with (most of) the content that is served, based on what the defaults are or what the user sets/unsets. It's generally considered 'easy' to play multimedia/sound directly from the browser (with a plugin, external app or the browser software itself) and most defaults settings will do this.
 
Old 02-06-2008, 02:33 PM   #3
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Original Poster
Rep: Reputation: 30
Thanks for the reply.
I cant figure that one out. I right click on my link, and there is no "save as" option only save link as (I guess this is the same thing). The only thing I can really do I click the link, and it plays in the browser.

If im looking to do this, Do I need to tell people above the link to Right click, and click "save link as"??

Thanks,
 
Old 02-06-2008, 02:35 PM   #4
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
You can use the AddType directive to override the MIME type on the server end but you would need to have different file extensions on two different files for them to behave differently. IE doesn't listen to what the server says about mime types anyway, it just goes by what the extension actually is.
 
Old 02-06-2008, 03:03 PM   #5
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Original Poster
Rep: Reputation: 30
Allright, thanks. Ill try adding an application mime type for mp3, and see if that works.

Security question: im trying to use php to authenticate users, and if logged in, then youll be able to download the mp3. Ive tried moving the mp3s to a folder above the document root, but i cant get to it. And id rather not use .htaccess, as i am using mysql and php to authenticate.
Is there a way to say "your only allowed to download this file (mp3) if you are authenticated"??

Thanks a million!
 
Old 02-06-2008, 03:18 PM   #6
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
I wrote a web app a few years ago that did that. I had a directory that was outside of the web directory that held the files and stored the path in the mysql database. There were a few php pear packages required to make it work so that it would handle the mime types correctly and the dtabase correlated certain files with certain users but it worked nice.
The stuff is on a computer at home, I will have to dig it up and I will post the pear packages I used.
 
Old 02-06-2008, 03:37 PM   #7
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 274

Original Poster
Rep: Reputation: 30
Thatd be awsome! thanks very much!

Ive tried this, and in order to protect the files, i have to go one directory above the document root of the website. However when I do, i get "Not Found" from the browser.

Thanks again!!!
 
Old 02-06-2008, 04:49 PM   #8
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
I used HTTP_Download to send the files from the server. I found that you did have to maintain a mime type column in the database so that the downloads would behave correctly, but that could be used to offer two different behaviors for the same file by just having two lines in the database for each file and referencing them seperately. If you are planning to upload files through the site as well, make sure you grab the mime type at upload.

apologies to the host for the off topic drift here
now back to your regular scheduled linux questions
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I am not able to play Mp3 Songs In Red Hat 9,How To Play The Songs? vlovevj_patel Linux - General 10 03-23-2008 11:45 PM
Play MP3 in FC4 .....diabled mp3 support !! ALInux Fedora 29 01-26-2006 07:20 AM
download and play mp3 using xmms mudda_steven Linux - Software 2 06-09-2005 08:11 PM
Download manager that you can set download times? henno Linux - Software 3 03-24-2005 06:49 PM
Limit browser connections to Apache and stop download accelerators Moloko Linux - Software 0 02-07-2005 07:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration