Page 1 of 1

Uploading multiple files with FOR

Posted: Tue Mar 28, 2006 5:03 pm
by Perfidus
I'm trying to upload a single file to different folders by using a for loop, but I only manage to introduce one.
Why?
Any hints ?

Code: Select all

$newarray = array_values($values);
$total=count($newarray);
$todaydate= date("Y-d-m");
for($i=0; $i<$total; $i++){
$values2=$newarray[$i];
$uploadDir = "../requested/".$values2."/";
$uploadFile = $uploadDir . $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile))
{
$sql=mysql_query("UPDATE Units SET internaldate='$todaydate' WHERE ip='$values2'", $connect) or die(mysql_error().'<p>'.$sql.'</p>'); 
}}

Posted: Tue Mar 28, 2006 5:28 pm
by feyd
move_uploaded_file() moves files. use move_uploaded_file() to make the initial move, then copy() the others from that.