copy() 函数的第二个参数不能是目录
2022-08-30 21:39:33
任何人都知道为什么会这样:
<?PHP
$title = trim($_POST['title']);
$description = trim($_POST['description']);
// Array of allowed image file formats
$allowedExtensions = array('jpeg', 'jpg', 'jfif', 'png', 'gif', 'bmp');
foreach ($_FILES as $file) {
if ($file['tmp_name'] > '') {
if (!in_array(end(explode(".",
strtolower($file['name']))),
$allowedExtensions)) {
echo '<div class="error">Invalid file type.</div>';
}
}
}
if (strlen($title) < 3)
echo '<div class="error">Too short title</div>';
else if (strlen($description) > 70)
echo '<div class="error">Too long desccription.</div>';
else {
move_uploaded_file($_FILES['userfile']['tmp_name'], 'c:\wamp\www\uploads\images/');
}
给:
警告:move_uploaded_file() [function.move-uploaded-file]:copy() 函数的第二个参数不能是第 41 行 C:\wamp\www\upload.php中的目录
警告:move_uploaded_file() [function.move-uploaded-file]:无法将 C:\wamp\tmp\php1AB.tmp 移动到 C:\wamp\www\uploads\images/' 中的第 41 行.php