Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Closed Thread
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-27-2007, 09:50 AM   PM User | #1
TrainReq
Guest

 
Posts: n/a
File downloading issues

Well... I am running this function:

PHP Code:

header
('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="ha.mp3"');
readfile('http://www.site.com/blah.mp3'); 
To more/less make the browser prompt to download the mp3... however, readfile causes the PHP to server-side read the file THEN spit out the promt to download, i need a readfile alternative so instead of reading the file, it will just automatically promt to download the file. because do to this being an offsite mp3, it takes really long to read it.

if there is no readfile alternatives... can i do it in JS somehow?

Last edited by TrainReq; 07-27-2007 at 09:59 AM..
 
Old 07-27-2007, 09:53 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
You don't need readfile. Also I just tried it with readfile and the prompt is instant. I think your issue might be because you are using the absolute url. Have you tried using the relative path?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline  
Old 07-27-2007, 09:04 PM   PM User | #3
TrainReq
Guest

 
Posts: n/a
The file i want it to download is off-site
 
Old 07-27-2007, 09:07 PM   PM User | #4
rafiki
Senior Coder

 
rafiki's Avatar
 
Join Date: Aug 2006
Location: Floating around somewhere...
Posts: 2,034
Thanks: 18
Thanked 42 Times in 42 Posts
rafiki will become famous soon enough
why is it off-site, why cant you host it on your site?/server?
__________________
Get Firefox Now
rafiki is offline  
Old 07-28-2007, 01:33 AM   PM User | #5
TrainReq
Guest

 
Posts: n/a
I am making an mp3 file ripper which rips mp3s from another site..
 
Old 07-28-2007, 09:54 AM   PM User | #6
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,911
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
which unless you have permission form the site owner is probably a bad thing so we can't really help you further.
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline  
Closed Thread

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:14 PM.


Advertisement
Log in to turn off these ads.