[asterisk-users] OT - How to stream a A-Law/wav file to a browser ?

Gordon Henderson gordon+asterisk at drogon.net
Thu Sep 18 12:52:14 CDT 2008


On Thu, 18 Sep 2008, Philipp Kempgen wrote:

> Gordon Henderson schrieb:
>
>> If the web server is running php, then this will work:
>>
>> <?
>>
>>    $action = $HTTP_GET_VARS["action"] ;
>>    $file   = $HTTP_GET_VARS["file"] ;
>>    $caller = $HTTP_GET_VARS["caller"] ;
>>
>>    if (empty ($action) || empty ($file))
>>      die ("Something went wrong")  ;
>>
>> // Open the file
>>
>>    $fileName = "/prefix/" . $file ;
>>    $fd       = @fopen ($fileName, "rb") ;
>
> Without any validation of the filename?
> It could be "../../secret/file".

Left as an excercise to the user. That's not what I use 'for real', I just 
hacked out the relevant bits.

Gordon




More information about the asterisk-users mailing list