MP3 upload form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thoughtriot
Forum Commoner
Posts: 26
Joined: Thu Nov 07, 2002 9:32 pm

MP3 upload form

Post by thoughtriot »

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

Post by fractalvibes »

uploading any kind of file should be pretty much the same, I would think.
What does your code look like? Are do doing image manipulation in the script?

Phil J.
thoughtriot
Forum Commoner
Posts: 26
Joined: Thu Nov 07, 2002 9:32 pm

Post by thoughtriot »

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');
?>
It is supposed to upload the mp3 and then input the mp3 information into the database. It adds the title, id, album id, and url for the mp3 into the database, but it won't upload the mp3.
Post Reply