Tengo un formulario el cual es para elegir una imagen:
Cita:
y este es ejCopy.php<form action="ejCopy.php" method="post" enctype="multipart/form-data">
Imagen: <input type="file" name="imagen" />
<input type="submit" name="enviar" />
Imagen: <input type="file" name="imagen" />
<input type="submit" name="enviar" />
Cita:
cuando selecciono una imagen por ejemplo del escritorio, me da un error de copiado.<?php
$img=$_FILES['imagen']['tmp_name'];
echo $img;
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<?php
$file = $img;
$newfile = 'movido/'.$img;
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
?>
</body>
</html>
$img=$_FILES['imagen']['tmp_name'];
echo $img;
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<?php
$file = $img;
$newfile = 'movido/'.$img;
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
?>
</body>
</html>
Gracias por la ayuda