Hello there, i got a problem uploading Mp3 files, i use this Form:

<form enctype="multipart/form-data" method="post" name="carica" action="car1.php"><tr>
 
  <td><font color="#990000">Nome Canzone: </td><td><input type="text" name="use"></td></tr>
<tr><td><font color="#990000">Nome Artista: </td><td><input type="text" name="art"></td>
<tr>
<td> <input name="uploaded" type="file" /></td><td><input type="submit" value="Caricare canzone" name="car"></td></tr>
</form>

and this Php :

$target = "";
$target = $target . basename( $_FILES['uploaded']['name']) ;
 $ok=1;
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{ echo "il file ". basename( $_FILES['uploaded']['name']). " e stato caricato.";
}
 else
{ echo "Errore nel caricamento.";
}

Now the problem is that the code WORKS for .jpg but DOESNT for mp3, the error i get is the following:

Notice: Undefined index: uploaded in E:\web\MusicStore1\car1.php on line 18

Notice: Undefined index: uploaded in E:\web\MusicStore1\car1.php on line 20

where the lines are:
$target = $target . basename( $_FILES) ;
and
if(move_uploaded_file($_FILES, $target))
respectivly


Thank you in advance

Recommended Answers

All 3 Replies

What you get when you use

print_r($_FILES)

It's empty :/

Hmm so the problem is with sending of data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.