Hello, I am trying to rename a file, and then if the file is there, upload it. I always get the message uploading failed though, here is what I am trying to do:
$k = 0;
foreach($_FILES["pics"]["name"] as $key => $current)
{
switch($k)
{
case 0:
$uploadfile = $uploaddir . basename("pic1jpg");
break;
case 1:
$uploadfile = $uploaddir . basename("pic2.jpg");
break;
case 2:
$uploadfile = $uploaddir . basename("pic3.jpg");
break;
}
if($current != "")
{
if (!move_uploaded_file($_FILES["pics"]["tmp_name"][$key], $uploadfile))
{
echo "{$current} uploading failed.";
}
}
$k++;
}