我住在巴西,发现这个网站来回答问题。发现它非常好。
这是错误信息吗
Warning: move_uploaded_file(): The second argument to copy() function cannot be a directory in C:\wamp\www\imoveis\cadastro.php on line 22
Call Stack
Warning: move_uploaded_file(): Unable to move 'C:\wamp\tmp\php6DC1.tmp' to 'banners/' in C:\wamp\www\imoveis\cadastro.php on line 22
这是给麻烦的代码行;
if(move_uploaded_file($banner_tmp, "banners/".$banner)):
这个页面是 cadastro.php
<?php
include_once "conexao/config.php";
include_once "functions/functions.php";
if(isset($_POST['cadastrar'])):
$titulo = filter_input(INPUT_POST, 'titulo', FILTER_SANITIZE_STRING);
$descricao = filter_input(INPUT_POST, 'descricao', FILTER_SANITIZE_STRING);
$banner_tmp = $_FILES['banner']['tmp_name'];
$larguraPermitida = 900;
$alturaPermitida = 300;
$dadosFoto = getimagesize($banner_tmp);
list($largura, $altura ,$numero, $tipo)= $dadosFoto;
if($largura > $larguraPermitida):
echo "Largura não pode ser maior que ".$larguraPermitida;
elseif($altura > $alturaPermitida):
echo "Altura não pode ser maior que ".$alturaPermitida;
else:
if(move_uploaded_file($banner_tmp, "banners/".$banner)):
cadastrarBanners($titulo,$banner,$descricao);
else:
echo "erro ao fazer upload";
endif;
endif;
endif;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="estilo/estilo.css" type="text/css" />
<link rel="stylesheet" href="estilo/acadastrar_admin.css" type="text/css">
<link rel="stylesheet" href="estilo/estilo.css" type="text/css" />
<link rel="stylesheet" href="estilo/button_iniciar.css" type="text/css">
<link rel="stylesheet" href="estilo/button_sobre.css" type="text/css">
<link rel="stylesheet" href="estilo/button_investir.css" type="text/css">
<link rel="stylesheet" href="estilo/button_imoveis.css" type="text/css">
<link rel="stylesheet" href="estilo/coin-slider-styles.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadastrar Banners</title>
</head>
<body>
<table width="1348" align="center" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">
<div id="topo">
<div id="telefone">
055 81 9992-5152
</div>
</div>
</th>
</tr>
<tr>
<td><?php include_once('menu.php');?></td>
</tr>
<tr>
<td> <div id="conteudo">
<?php include_once('menu.php');?>
<div id="cadastrar_administrador">
<form action="" method="post" enctype="multipart/form-data">
<fieldset class="first">
<label class="labelOne" for="titulo">Titulo:</label>
<input type="text" name="titulo"/>
<label for="descricao">Descrição:</label>
<input type="text" name="descricao"/>
<label for="banner">Banner:</label>
<input type="file" name="banner"/>
<label class="btn" for="submit"></label>
<input class="btn" type="submit" name="cadastrar" value="Cadastrar Banner"/>
</fieldset>
</form>
</div>
</div>
</td>
</tr>
<tr>
<td><div align="center" id="rodape">
sjncsjknckjsdc
</div>
</td>
</tr>
</table>
</body>
</html>
有人能帮助我吗。