Foros del Web » Programando para Internet » PHP »

Referenciar archivos subidos mediante un iframe.

Estas en el tema de Referenciar archivos subidos mediante un iframe. en el foro de PHP en Foros del Web. Que tal gente, les cuento, tengo un formulario para dar de alta avisos y en el mismo existe un iframe para subir una imagen. El ...
  #1 (permalink)  
Antiguo 08/09/2008, 18:36
 
Fecha de Ingreso: marzo-2007
Mensajes: 340
Antigüedad: 17 años, 1 mes
Puntos: 4
Referenciar archivos subidos mediante un iframe.

Que tal gente, les cuento, tengo un formulario para dar de alta avisos y en el mismo existe un iframe para subir una imagen.

El problema es que no se de que forma me conviene referenciar las imagenes que el usuario sube al futuro aviso que publicara, en caso de dar de alta el aviso, como lo referenciarian con las imagenes ???

Digamos, una onda gmail, donde pueden cargar las imagenes antes de enviar el email para que entiendan lo que digo.

Se me ocurren algunos metodos algo nublados, pero me gustaria saber cual es la forma mas optima para hacerlo !

Dejo el codigo del iframe en caso de que quieran verlo:

Código:
<?php
if(isset($_GET['LOADING']))
{
	header("Content-type:image/gif");
	echo base64_decode('R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH+GkNyZWF0ZWQgd2l0aCBhamF4bG9hZC5pbmZvACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQACgABACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkEAAoAAgAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkEAAoAAwAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkEAAoABAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQACgAFACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQACgAGACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAAKAAcALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==');
	exit;
}
if($_FILES['archivo'])
{
    if(10240000 > $_FILES['archivo']['size'])
	{
        $tmp = $_FILES['archivo']['tmp_name'];
        $name = $_FILES['archivo']['name'];
        if(move_uploaded_file($tmp, 'tmp/fotos/' . $name))
		{
            echo '
            <script>
            parent.document.getElementById("loading").style.display="none";
            parent.document.getElementById("mensaje").innerHTML="Archivo grabado correctamente";
            old_f=parent.document.getElementById("archivo");
            new_f=parent.document.createElement("input");
            new_f.type="file";
            new_f.name="archivo";
            new_f.value="";
            new_f.id="archivo";
               new_f.onchange=function(){
                parent.document.getElementById("mensaje").innerHTML="";
            }
            old_f.parentNode.replaceChild(new_f,old_f);
            </script>';
            exit;
        }
    }
	echo '
            <script>
            parent.document.getElementById("loading").style.display="none";
            parent.document.getElementById("mensaje").innerHTML="El archivo no pudo grabarse.";
            old_f=parent.document.getElementById("archivo");
            new_f=parent.document.createElement("input");
            new_f.type="file";
            new_f.name="archivo";
            new_f.value="";
            new_f.id="archivo";
               new_f.onchange=function(){
                parent.document.getElementById("mensaje").innerHTML="";
            }
            old_f.parentNode.replaceChild(new_f,old_f);
            </script>';
exit;
}
?>
<!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>test</title>
</head>

<body><form target="pepe" method="post" enctype="multipart/form-data" action="<?php echo basename($_SERVER['PHP_SELF'])?>" onsubmit="if(document.getElementById('archivo').value.length)document.getElementById('loading').style.display='inline'">
<div id="mensaje" style="font-family:Verdana, Arial, Helvetica, sans-serif; color:red; font-size:9px"></div>
<input type="file" name="archivo" id="archivo" size="26" class="campoArchivo" onchange="document.getElementById('mensaje').innerHTML=''" />
<input type="submit" value="Cargar archivo" />
&nbsp;<img id="loading" src="?LOADING" width="16" height="16" style="display:none" />
</form>
<iframe name="pepe" width="1" height="1" style="visibility:hidden"></iframe>
</body>
</html>
Muchas gracias.

Última edición por WebDeveloperZ; 08/09/2008 a las 18:42
  #2 (permalink)  
Antiguo 09/09/2008, 16:00
 
Fecha de Ingreso: marzo-2007
Mensajes: 340
Antigüedad: 17 años, 1 mes
Puntos: 4
Respuesta: Referenciar archivos subidos mediante un iframe.

Nadie ????¿?¿?¿?¿?
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:59.