tags:

views:

29

answers:

1

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 
+1  A: 

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 ");
Artefacto
I am trying to skip this step. I just want to extract the mp3 from the url and save it locally. exec( "lame ".SOMELOCATION."/".$file.".wav ". LOCATION."/{$_GET['Sub']}/".$file.".mp3 ");
Matt
@John Apparently what you want and what you say you want are not the same thing. WHat you mean save locally? You realize this is PHP, "local" is server-side. That isn't what you want?
Artefacto
ok so basically what i want is this a copy file command copy_file_command(TEMP_LOC."/".$AudioFilename.".mp3", LOCATION."/{$Subdirectory}/".$AudioFilename.".mp3");
Matt