Re: Force-Saving an Audio File

From: Date: Wed, 09 Dec 2009 16:39:04 +0000
Subject: Re: Force-Saving an Audio File
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-300338@lists.php.net to get a copy of this message
On Dec 9, 2009, at 12:27 AM, Gaurav Kumar wrote:
You can do two things- 1. Read the file by providing a base directory path of the server where the file exist. Something like- //htdocs/httpfolder/files/audio/yourfile.mp3 You can take this in a variable " //htdocs/httpfolder/files/audio/". 2. Try using file_get_contents. Something like $file = file_get_contents(' http://www.example.com/audio/file.mp3', false, $context); Hope this helps.
Thanks for your help Gaurav, After a few tests based on your suggestions - I noticed why I think there was a problem: this line: elseif (! file_exists( $path ) ) worked locally but failed when the path was a http url: $directory = "http://mysite.com/test1/"; so when I took out that elseif then readfile("$path"); did work SO: Is there a php function that can work like file_exists( $path ) and tell if the file exists but work from a URL like: $thisfile = "http://mysite.com/test1/audio.mp3"; Thanks, cool@hosting4days.com

« previous php.general (#300338) next »