MP3 upload form
Moderator: General Moderators
-
thoughtriot
- Forum Commoner
- Posts: 26
- Joined: Thu Nov 07, 2002 9:32 pm
MP3 upload form
I know how to upload image files using a form and php, but I was wondering how I could upload mp3s using a form and php, because when I try it with the image form, it give me errors. Thanks.
-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
-
thoughtriot
- Forum Commoner
- Posts: 26
- Joined: Thu Nov 07, 2002 9:32 pm
Code: Select all
<?
include('../top.php');
echo "<p align=center><b>Add MP3</b><br>Be patient. This could take a while.</p>";
if($submit) {
copy($file, "/home/arsonfor/public_html/music/mp3s/$file_name");
$result=MYSQL_QUERY("INSERT INTO mp3s (ID,Title,URL,Album)".
"VALUES ('NULL', '$Title', '$file_name', '$Album')");
print "MP3 added";
}
else
{
?>
<form method="post" ENCTYPE="multipart/form-data" action="addmp3s.php">
Title:<br>
<INPUT TYPE='TEXT' NAME='Title' size=60><br>
Album:<br>
<select name='Album'>
<?
$result = mysql_query ("SELECT * FROM albums ORDER BY Title ASC");
while($r=mysql_fetch_array($result))
{
$ID = $r["ID"];
$Title = $r["Title"];
echo "<option value=$ID>$Title</option>";
}
?>
</select><br>
MP3:<br>
<input type="file" size="60" name="file"><br>
<INPUT TYPE="submit" name="submit" value="Submit">
</form>
<?
}
include('../bottom.php');
?>