Comunidad de diseño web y desarrollo en internet online

Ftp en php

Citar            
MensajeEscrito el 17 Dic 2007 12:54 pm
Buenas a todos!!

Llevo un par de dias dandole vueltas a esto...

Resulta que e echo un ftp en php, el cual sube el archivo a un directorio.

Al parecer todo va bien...pero no me aparece el archivo en el servidor...

os paso el codigo a ve si sabeis por ke....


guarda.php

<!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&iacute;tulo</title>
</head>

<body bgcolor = "#303030">
<body text = "#ffffff">
<body leftmargin = "60">
<body topmargin = "60">
<font face = "Tahona">
<font size = "3">
<form enctype="multipart/form-data" action="recepcion.php" method="post">
<input type = "hidden" name = "lim_tamano" value="500000" />
<b>
<font size = "6">
Formulario para el envío de ficheros:
</b>
</font size>
<p><b>Archivo a transferir <b><br>
<input type="file" name="archivo"></p>
<p><input type="submit" name="enviar" value="Aceptar">
</p>
</form>
</head>
<b>Intrucciones de uso: Pulse el botón Examinar y seleccione el archivo que desee y luego pulse enviar
</b>
</body>
</html>



recepcion.php

<!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&iacute;tulo</title>
</head>
<body bgcolor = "#303030">
<body text = "#ffffff">
<body leftmargin = "60">
<body topmargin = "60">
<font face = "Tahona">
<font size = "3">
<?
if ($archivo != "none" AND $archivo_size != 0 AND $archivo_size<=$lim_tamano){
if (copy ($archivo, "/home/html/galeria/galeria1".$archivo_name)){
echo "<h2>Se ha transferido el archivo $archivo_name </h2>";
echo "<br>Su tamaño es: $archivo_bytes <br>";
echo "<br>Su tipo es: $archivo_type <br>";
}
}else{
echo "<h2> No se ha podido tranferir el archivo</h2>";
echo"<h3> Su tamaño no puede exceder $lim_tamano bytes</h2>";
}
echo "<a href='.$archivo_name.'>";
?>
<body>
</body>
</html>



A ver si me podeis ayudar y gracias a la gran labor que haceis!

Por bui3

71 de clabLevel



Genero:Masculino  

opera
Citar            
MensajeEscrito el 17 Dic 2007 05:47 pm

Por master_of_puppetz

Claber

2483 de clabLevel

7 tutoriales
3 articulos

Genero:Masculino   Premio_Secretos

WebDev (Flex + PHP + JS)

firefox
Citar            
MensajeEscrito el 17 Dic 2007 10:36 pm
Esto no es "ftp en PHP", es una trasferencia con HTTP común y silvestre. Pero el código que has posteado tiene errores.
En el segundo script estás programando como si tuvieras register_globas ON, mal hecho, para extraer los datos del formulario debes usar $_POST y $_FILES.
Cuando se sube un archivo al servidor éste lo armacena en un directorio temporal con un nombre aleatorio que luego tú tienes que mover al lugar definitivo y con el nombre definitivo dentro de tu "home".

Por DriverOp

Claber

2510 de clabLevel



 

opera
Citar            
MensajeEscrito el 18 Dic 2007 07:18 am
Al parecer el servidor al ke esta subido estos codigos tiene un tiempo de espera pa colocarte el archivo en su sitio...oy al despertarme lo mire y ya esta en su sitio!

weno de todas maneras lo intentare con el ftp...a ve ke tal va ese codigo...

Grasias a todos!

Por bui3

71 de clabLevel



Genero:Masculino  

opera

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.