Cita:
Iniciado por DarkJ
Entonces es que no estas recibiendo ningun fichero. Puede ser un fallo de tu formulario. ¿Le has puesto el enctype?
ahi esta el detalle, a donde pongo enctype??? please
je ia lo puse Gracias
Darkj eres un genio
Warning: move_uploaded_file(..img/pablo/18/3.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\AppServ\www\nuevo\c_i_imagen2.php on line 54
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\TEMP\php9B4F.tmp' to '..img/pablo/18/3.jpg' in C:\AppServ\www\nuevo\c_i_imagen2.php on line 54
me sale ese error me pueden ayudarme
Warning: move_uploaded_file(../img/pablo/18/3.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\AppServ\www\nuevo\c_i_imagen2.php on line 55
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\TEMP\phpCAC1.tmp' to '../img/pablo/18/3.jpg' in C:\AppServ\www\nuevo\c_i_imagen2.php on line 55
me sale ese error
el codido es el siguente
Código PHP:
<?
require_once("cb.php");
cn();
session_start();
if(!session_is_registered("v_sesion"))
{
?>
<script>
alert('debes logearte');
document.location='f_login.php';
</script>
<?
exit();
}
$idusuario=$_SESSION["v_sesion"];
$idnoticia=$_COOKIE["idnoticia"];
$img=$_FILES["imagen"]["name"];
$tamanio=$_FILES["imagen"]["size"];
$ruta_temp=$_FILES["imagen"]["tmp_name"];
if($tamanio>1000000)
{
?>
<script>
alert('imagen muy grande tio, no seas gilipollas');
document.location='f_i_imagen2.php';
</script>
<?
exit;
}
$tipo_archivo=$img;
$tipo_archivo_long=strlen($tipo_archivo)-3;//strlen saca el tamaño de la cadena
$tipo_archivo=substr($tipo_archivo,$tipo_archivo_long);//sustrae la letras de una cadena
$files=array();
$files[]="png";
$files[]="jpeg";
$files[]="gif";
$files[]="jpg";
$tipo_archivo=strtolower($tipo_archivo);
$r=array_search($tipo_archivo,$files); //busca un una cadena en un array
if(!$r)
{
?>
<script>
alert('la cagas eso que quieres subir no es imagen pendejo');
document.location='f_i_imagen2.php';
</script>
<?
exit;
}
mysql_query("INSERT INTO imagen(idnoticia,ruta) VALUES('$idnoticia','$ruta')");
$rs=mysql_query("SELECT idimagen FROM imagen WHERE idnoticia='$idnoticia'");
$id=mysql_result($rs,0,"idimagen");
$rut="../img/".$idusuario."/".$idnoticia."/".$id.".jpg";
chmod("img",0777);
if(move_uploaded_file($_FILES["imagen"]["tmp_name"],$rut))
{
?>
<script>
alert('foto grabada');
document.location='f_i_imagen.php';
</script>
<?
exit;
}
?>