Re: Force-Saving an Audio File

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cool@xxxxxxxxxxxxxxxx wrote:
> 
> 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@xxxxxxxxxxxxxxxx
> 

You could possibly check the results of get_headers($thisfile);


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux