Reputation: 3
I post a file by HTML and I want to move it but it always return value false. here's my code :
$fileName = $_FILES['atc']['name'];
$fileTmp = $_FILES['atc']['tmp_name'];
$newDir = "/home/goes/attachments/" . $fileName;
$a = move_uploaded_file($fileTmp, $newDir);
if ($a==true){
echo "true";
}
else{
echo "false";
}
Upvotes: 0
Views: 92
Reputation: 74
foreach ($_FILES['atc']['tmp_name'] as $key => $tmp_name){
$path = "home/goes/attachments/" . $fileName";
move_uploaded_file($tmp_name, $path);
}
Upvotes: 0
Reputation: 3546
Upvotes: 0