I'm new here.
I need to upload Multiple mp3 files to a directory and store them in the 'audio' table in mysql.
I'm using this script but it works only with one file, it's annoying to do one track each time. That's why I need a multiple upload script.
I wish to only write the title of each track like this:
php: file1.mp3 [0] file2.mp3 [1] file3.mp3 [2]
html form: File 1 title: .... File 2 title: .... File 3 title: ....
insert to 'audio'
Sorry for my bad English. i hope you know what I mean
<?php if(isset($_POST['kkupload'])){
$filename = $_FILES['foto']['name'];
$extensie = substr($filename, -3);
$map = "/mounted-storage/home150/sub007/sc80538-VHHY//audio/files/";
$file = $_FILES['foto'];
$breedte = $_FILES['foto'];
$max_bytes = 100000000000;
if(strtolower($extensie) != "mp3" && strtolower($extensie) != "jpg" && strtolower($extensie) != "jpeg" && strtolower($extensie) != "png" && strtolower($extensie) != "bmp")
{
echo "Je kan alleen .gif, .jpg .jpeg en .png bestanden uploaden!";
}
elseif($_FILES['foto']['size'] > $max_bytes) { echo("Het bestand is groter dan ".$max_bytes." bytes!"); }
else {
$length = strlen($filename);
$name = "pict";
$name = substr($filename, 0, $length - 4);
$i = "1";
$tempname = $name;
$picName = $_FILES['foto']['name'];
$titel = htmlspecialchars($_POST['titel']);
$bericht = $_POST['bericht'];
$url = htmlspecialchars($_POST['pica']);
$youtube = $_POST['youtube'];
$nr = rand(0,99999999999);
if(file_exists($_FILES['foto']['name']))
{
$picName = $nr. $_FILES['foto']['name'];
if(file_exists($picName))
{
$picName = $nr. $_FILES['foto']['name'];
}
}
move_uploaded_file($_FILES['foto']['tmp_name'], $map.$_FILES['foto']['name']."") or die("Fout met uploaden plaatje");
mysql_query("INSERT INTO `audio` (titel, url, categorie) values ('".$titel."', '/audio/files/".$picName."','".$bericht."')");
echo "je hebt succesvol nieuws geupload!"; }}?>
<form action="?pagina=addnieuws" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="100%" border="0" cellpadding="2" cellspacing="2" id="form1">
<tr>
<td width="77"><b> <font size="2" face="Verdana">Tite track:</font></b>
</div></td>
<td><font size="2">
<input name="titel" type="text" id="Titel" size="63" />
</font></td>
</tr>
<tr>
<td width="77"><b> <font size="2" face="Verdana">Plaatje:</font></b>
</div></td>
<td><font size="2">
<input type="file" name="foto" size="52" />
</font><b><font size="1" face="Verdana"> <br />
MP3</font></b></td>
</tr>
<tr>
<td valign="top" width="77"><b> <font size="2" face="Verdana">Artiest:</font></b>
</div></td>
<td>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
new nicEditor({fullPanel : true}).panelInstance('area2');
});
</script>
<select name="bericht">
<?php
$query = mysql_query("SELECT * FROM artiesten ORDER BY naam ASC");
while ($array = mysql_fetch_assoc($query)){
echo "<option value=\"". $array['naam'] ."\">". $array['naam']. "</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td width="77" colspan="2"><font size="2">
<input type="submit" name="kkupload" value="Upload" />
</font></td>
</tr>
</table>
</form>