I want to do this for multiple files. I tried to do this with a foreach
-loop but I think I made some mistakes with the array "userfile". In
this example userfile is just the "name" in the input tag. When
uploading multiple files userfile is -ofcourse- an array like this:
name='userfile[]'. Now I want to know how to handle with that array in
somekind of a loop. For one file the script is this:
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
$namename=$_FILES['userfile']['name'];
move_uploaded_file($_FILES['userfile']['tmp_name'],"/path/$namename");
if (rename("/path/$namename", "/path/$uartist-$usong.mp3"))
{
$query = "INSERT INTO table (column1,column2,column3) values
('$value1','$value2','$value3')";
mysql_query($query) or die ("Couldn't make query!");
print "File Upload and rename succesful!";
} else { print "File Upload failed!"; }
}
antti
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php