Question

So i have a script in my php file that takes a .wav file and converts it to a .mp3

exec( "lame ".SOMELOCATION."/".$file.".wav  ".LOCATION."/{$Sub}/".$file.".mp3 ");

I now need to take the file from the url and save it to the location listed above

For example:

it will come in like this

 http://someurl.com/audio/something.mp3 

and i need to take that mp3 and download it and save it in

LOCATION."/{$Sub}/".$file.".mp3 
Was it helpful?

Solution

Take the subdirectory from the URL: `http://example.com/?Sub=subdir

if (!isset($_GET['Sub']) || is_array($_GET['Sub']) ||
        !preg_match('/[a-z0-9]/i', $_GET['Sub']))
    die("invalid subdirectory");

exec( "lame ".SOMELOCATION."/".$file.".wav  ".
    LOCATION."/{$_GET['Sub']}/".$file.".mp3 ");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top