Hey guys,
I have a script that uploads MP3 files into a certain directory on my site... I use a pretty simple mothod and in order to play the mp3s, the script makes a m3u file and whatnot... which all works....
EXCEPT - when I upload files over somewhere in the vicinity of 2.5 mb. Everything works for file below that, but not over. It makes the m3u file, but when I go check in the folder, the mp3 does not appear to be there. Is there some sort of upload limit to PHP? If so, can I bypass it? Anyhow, here is the code...
Code:
<?
session_start();
if($_SESSION["online"] != "granted")
{
echo '<script>alert("You are not logged into WUC.");</script>';
header( "Location: index.html");
}
if(file_exists('upload/'.$_FILES['file']['name']))
{
echo '<script>alert("The file name already exists!");</script>';
echo '<script>history.back(1);</script>';
}
else
{
$uploadto = 'upload/';
$uploadfile = $uploadto . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
}
$filename = $_FILES['file']['name'];
$songurl = "upload/$filename";
$prefirstnameofm3u = "$_POST[bandname]-$_POST[songtitle]";
$firstnameofm3u = addslashes($prefirstnameofm3u);
$secondnameofm3u = trim($firstnameofm3u);
$thirdnameofm3u = strtolower($secondnameofm3u);
$nameofm3u = str_replace(" ", "_", $thirdnameofm3u);
$mp3location = "http://www.loaded-designs.com/wuc/$songurl";
$file = "upload/$nameofm3u.m3u";
$open = fopen($file, "w+");
fwrite($open, $mp3location);
fclose($open);
$table_name = "listen";
include("dbfactors.inc");
$connection = mysql_connect("$host", "$db_user", "$db_password")
or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "INSERT INTO $table_name (bandname, songtitle, songurl, songhttp) VALUES ('$_POST[bandname]', '$_POST[songtitle]', '$file', '$songurl')";
$result = @mysql_query($sql,$connection) or die(mysql_error());
}
?>