Hi,
While I know there are many free programs to do this, a friend of mine still wants it done this way but I cannot get it to work on large files. Basically, he wants a web page to go to where he can upload a wav file and hit the convert button. Then php will execute lame using the system function to convert it to an mp3 file. I have gotten this to work for very small sound files (wav files that are < 1 MB or so). I have set the max upload file size to 200 MB and it still isnt working. If anyone has any ideas please let me know. Here is the code:
upload.php.php
Code:
<center>
<form enctype="multipart/form-data" action="convert.php" method="post">
<h1>Choose a Wav file to convert to MP3:</h1><br> <input name="userfile" type="file" />
<input type="submit" value="Convert" />
</form>
Convert.php
Code:
<?php
$uploadDir = '/tmp/';
$uploadFile = $uploadDir . $_FILES['userfile']['name'];
print "<center><pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile))
{
print "File was successfully uploaded!<br><br>";
echo "Converting file to mp3 ... please be patient";
$convert = System("lame $uploadFile $uploadFile.mp3");
echo "$convert";
echo "<center><a href=/phpconvert$uploadFile.mp3><h1>Download File</h1></a>";
}
else
{
echo "<center><h1>Something didn't work right!</h1>";
}
print "</pre>";
?>