if ($action == "vedlegg" && $chk > "2") {
for($i = 0; $i < count($_FILES['file']); $i++) {
$date = date('d-m-y');
$rand = rand(100000,1500000);
$temp = $_FILES['file']['tmp_name'][$i++];
rename("$temp", "upload/nyheter/$date-$rand.JPG");
echo "Bilde er ferdig opplastet
"; } }