![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
28/04/2005, 02:41
|
| | Fecha de Ingreso: enero-2002 Ubicación: Graná
Mensajes: 646
Antigüedad: 23 años, 1 mes Puntos: 0 | |
¡Ya me funciona! ole, ole y ole. Ahí va el código para que lo vea quien le interese
<FORM NAME=\"subir_fichero\" METHOD=\"POST\" ACTION=\"ftp.php\">
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"30000\">
<INPUT TYPE=\"hidden\" NAME=\"accion\" VALUE=\"subir_fichero\">
<INPUT TYPE=\"hidden\" NAME=\"dirActual\" VALUE=\"$dirActual\">
<INPUT TYPE=\"file\" NAME=\"file\">
<input type=\"submit\" value=\"Subir fichero\">
<br><select name=\"metodo\">
<option value=\"FTP_BINARY\" selected>Binario</option>
<option value=\"FTP_ASCII\">ASCII</option>
</select>
</Form>
y ya en ftp.php
$file=$_POST['file'];
$metodo=$_POST['metodo'];
$nombre_fich=strrchr(stripslashes ($file), "\\"); //esto me devuelve \"nombre de fichero"
$nombre_fich=substr ($nombre_fich, 1); //para quitarle la barra de antes y dejar sólo el nombre del fichero
if (!$id_fichero=@fopen ($file, 'r'))
$msg="<font color=red>Error al abrir el fichero</font>";
else{
if (!ftp_fput($conexion, $nombre_fich, $id_fichero, (float) $metodo))
$msg= "Error al subir el fichero";
fclose ($id_fichero);
} |