<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><font face="arial" size="2">Si, entendí ahora lo modifique pero me tira errores en chmod me dice que no existe directorio, sin embargo me muestra los archivos que quiero bajar cuando me tira el error de ftp_get()</font><div style="font-family: arial; font-size: 10pt;">ahi va</div><div><div style="font-family: arial; font-size: 10pt;">$dir_local= mkdir("c:/fotos_".date('d-m-Y'),0777);</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">        </span>$dir=$_POST['carpeta'];</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">       </span>$nombre_usuario_ftp=$_POST["usuario"];</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">      </span>$contrasenya_ftp=$_POST["clave"];</div><div style="font-family: arial;
 font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">      </span>$servidor_ftp=$_POST["servidor"];</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">   </span>$id_con = ftp_connect($servidor_ftp,21) or die("No ha sido posible conectarse a $servidor_ftp");</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">    </span>ftp_login($id_con,$nombre_usuario_ftp,$contrasenya_ftp); //Se loguea al Servidor FTP</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">  </span>ftp_pasv($id_con,MODO); //Establece el modo de conexión</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">       </span>$newdir = "/public_html/".$dir."/";</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">
        </span>chmod($newdir,777);</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">   </span>$list = ftp_nlist($id_con, $newdir);</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">  </span>$cant=count($list);</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">   </span></div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">      </span>for($i=0;$i<$cant;$i++ ){</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">          </span></div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">              </span>$file = ftp_get($id_con, $dir_local."/".$list[$i], $newdir.$list[$i], FTP_BINARY);</div><div style="font-family: arial; font-size: 10pt;"><span
 class="Apple-tab-span" style="white-space:pre"> </span>}</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">     </span>if ($cant == 0){</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">              </span>echo "El directorio no existe en el servidor";</div><div style="font-family: arial; font-size: 10pt;"><span class="Apple-tab-span" style="white-space:pre">      </span>}</div><div style="font-family: arial; font-size: 10pt;">///el error es </div><div style="font-family: arial; font-size: 10pt;"><b style="font-family: 'Times New Roman'; font-size: medium;">Warning</b><span style="font-family: 'Times New Roman'; font-size: medium;">: chmod() [</span><a href="http://localhost/vortex/function.chmod" style="font-family: 'Times New Roman'; font-size: medium;">function.chmod</a><span style="font-family: 'Times New Roman'; font-size: medium;">]: No such file
 or directory in </span><b style="font-family: 'Times New Roman'; font-size: medium;">C:\wamp\www\vortex\formulario-descarga-archivos.php</b><span style="font-family: 'Times New Roman'; font-size: medium;"> on line </span><b style="font-family: 'Times New Roman'; font-size: medium;">49</b><br style="font-family: 'Times New Roman'; font-size: medium;"><br style="font-family: 'Times New Roman'; font-size: medium;"><b style="font-family: 'Times New Roman'; font-size: medium;">Warning</b><span style="font-family: 'Times New Roman'; font-size: medium;">: ftp_get() [</span><a href="http://localhost/vortex/function.ftp-get" style="font-family: 'Times New Roman'; font-size: medium;">function.ftp-get</a><span style="font-family: 'Times New Roman'; font-size: medium;">]: I can only retrieve regular files in </span><b style="font-family: 'Times New Roman'; font-size: medium;">C:\wamp\www\vortex\formulario-descarga-archivos.php</b><span
 style="font-family: 'Times New Roman'; font-size: medium;"> on line </span><b style="font-family: 'Times New Roman'; font-size: medium;">55</b><br style="font-family: 'Times New Roman'; font-size: medium;"><br style="font-family: 'Times New Roman'; font-size: medium;"><b style="font-family: 'Times New Roman'; font-size: medium;">Warning</b><span style="font-family: 'Times New Roman'; font-size: medium;">: ftp_get(1/..) [</span><a href="http://localhost/vortex/function.ftp-get" style="font-family: 'Times New Roman'; font-size: medium;">function.ftp-get</a><span style="font-family: 'Times New Roman'; font-size: medium;">]: failed to open stream: Permission denied in </span><b style="font-family: 'Times New Roman'; font-size: medium;">C:\wamp\www\vortex\formulario-descarga-archivos.php</b><span style="font-family: 'Times New Roman'; font-size: medium;"> on line </span><b style="font-family: 'Times New Roman'; font-size:
 medium;">55</b><br style="font-family: 'Times New Roman'; font-size: medium;"><br style="font-family: 'Times New Roman'; font-size: medium;"><b style="font-family: 'Times New Roman'; font-size: medium;">Warning</b><span style="font-family: 'Times New Roman'; font-size: medium;">: ftp_get() [</span><a href="http://localhost/vortex/function.ftp-get" style="font-family: 'Times New Roman'; font-size: medium;">function.ftp-get</a><span style="font-family: 'Times New Roman'; font-size: medium;">]: Error opening 1/.. in </span><b style="font-family: 'Times New Roman'; font-size: medium;">C:\wamp\www\vortex\formulario-descarga-archivos.php</b><span style="font-family: 'Times New Roman'; font-size: medium;"> on line </span><b style="font-family: 'Times New Roman'; font-size: medium;">55</b><br style="font-family: 'Times New Roman'; font-size: medium;"><br style="font-family: 'Times New Roman'; font-size: medium;"><b style="font-family: 'Times New
 Roman'; font-size: medium;">Warning</b><span style="font-family: 'Times New Roman'; font-size: medium;">: ftp_get(1/Foto0522.jpg) [</span><a href="http://localhost/vortex/function.ftp-get" style="font-family: 'Times New Roman'; font-size: medium;">function.ftp-get</a><span style="font-family: 'Times New Roman'; font-size: medium;">]: failed to open stream: No such file or directory in </span><b style="font-family: 'Times New Roman'; font-size: medium;">C:\wamp\www\vortex\formulario-descarga-archivos.php</b><span style="font-family: 'Times New Roman'; font-size: medium;">on line </span><b style="font-family: 'Times New Roman'; font-size: medium;">55</b><br style="font-family: 'Times New Roman'; font-size: medium;"></div><div style="font-family: arial; font-size: 10pt;"><b style="font-family: 'Times New Roman'; font-size: medium;">etc por cada archivo</b></div><div><b>Agradezco la ayuda</b></div><br><font face="arial" size="2">--- El </font><b
 style="font-family: arial; font-size: 10pt;">mar 7-may-13, Leonardo Tadei - Pegasus Tech Supply <i><leonardot@pegasusnet.com.ar></i></b><font face="arial" size="2"> escribió:</font><br><blockquote style="font-family: arial; font-size: 10pt; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>De: Leonardo Tadei - Pegasus Tech Supply <leonardot@pegasusnet.com.ar><br>Asunto: Re: [Php-avanzado] ruta ftp<br>Para: "Lista del curso de PHP Avanzado" <php-avanzado@pato2.fi.mdp.edu.ar><br>Fecha: martes, 7 de mayo de 2013, 14:40<br><br><div class="plainMail">Hola Damián,<br><br>    estás empezando la ruta con / en /public_html/ con lo que le estás<br>diciendo que public_html están en la raíz del disco, y lo más habitual<br>es que esté en /home/usuario<br><br>    Lo mejor para estos casos es entrar por FTP, ver qué nombres tienen
 los<br>directorios, y luego escribir rutas relativas (no absolutas) en dónde<br>trabajar.<br><br>    Sin embargo, acá no hacés ningún upload ni download por FTP, con lo que<br>te conviene usar directamente las funciones de manejo de disco y<br>archivos, ya que no le estás dando ningún uso al FTP.<br><br>    Para terminar, salvo que estés usando alguna versión muy vieja de PHP,<br>es más simple la función scandir() que te devuelve un vector, que<br>trabajar con opendir() que te obliga luego a recorrer el directorio.<br><br>    Salu2!<br><br><br>El mar, 07-05-2013 a las 06:28 -0700, Damián Colledani escribió:<br>> Alguien me puede decir como saber la ruta a los archivos que debo<br>> descargar via ftp?<br>> Teoricamente estan en /public_html/ pero el directorio que consulto<br>> con is_dir me dice que no existe<br>> Mando todo el script por si acaso Gracias<br>> <br>> <br>>
 $nombre_usuario_ftp=$_POST["usuario"];<br>> $contrasenya_ftp=$_POST["clave"];<br>> $servidor_ftp=$_POST["servidor"];<br>> $id_con = ftp_connect($servidor_ftp,21) or die("No ha sido posible<br>> conectarse a $servidor_ftp");<br>> <br>> <br>> $carpeta="/public_html/".$_POST["carpeta"]."/";<br>> if (ftp_login($id_con, $nombre_usuario_ftp, $contrasenya_ftp)){<br>> echo "Conectado en $nombre_usuario_ftp@$servidor_ftp "; <br>> <br>> if (is_dir($carpeta)==true)<br>> { <br>> echo "<br> Existe carpeta";<br>> $abredir=opendir($carpeta);   //abro el directorio y recorro el<br>> directorio buscando los archivo<br>> echo "<br> Abrio carpeta";<br>> while (false!==($nombre_archivo=readdir($abredir)))<br>> {<br>> if (($nombre_archivo !== ".") && ($nombre_archivo !== ".."))<br>>   //valido que no sean . ni ..<br>> {   <br>>
 //if($aux==$nombre_archivo)<br>> //{<br>> //return $aux;<br>> DescargarArchivo($nombre_archivo);<br>> <br>> //}<br>> }<br>> }<br>> }else{<br>> echo "La Carpeta no Existe";<br>> }<br>> }<br>> <br>> <br>> function DescargarArchivo($fichero){<br>> <br>> <br>> $basefichero = basename($fichero);<br>> <br>> <br>> header( "Content-Type: application/octet-stream");<br>> <br>> <br>> header( "Content-Length: ".filesize($fichero));<br>> <br>> <br>> header( "Content-Disposition:attachment;filename=".$basefichero);<br>> readfile($fichero);<br>> }<br>> }<br>> _______________________________________________<br>> Php-avanzado mailing list<br>> <a ymailto="mailto:Php-avanzado@pato2.fi.mdp.edu.ar" href="/mc/compose?to=Php-avanzado@pato2.fi.mdp.edu.ar">Php-avanzado@pato2.fi.mdp.edu.ar</a><br>> <a href="http://www3.fi.mdp.edu.ar/cgi-bin/mailman/listinfo/php-avanzado"
 target="_blank">http://www3.fi.mdp.edu.ar/cgi-bin/mailman/listinfo/php-avanzado</a><br><br>-- <br><br>Leonardo Tadei<br><a ymailto="mailto:leonardot@pegasusnet.com.ar" href="/mc/compose?to=leonardot@pegasusnet.com.ar">leonardot@pegasusnet.com.ar</a><br>Pegasus Tech Supply<br>Tel: (+54)(+223) 471-2880<br>La Salle 1131 - Mar del Plata - Argentina<br><a href="http://www.pegasusnet.com.ar" target="_blank">http://www.pegasusnet.com.ar</a><br><a href="http://www.grupopegasus.com" target="_blank">http://www.grupopegasus.com</a><br>Firma pública: <a href="http://www.pegasusnet.com.ar/LeonardoTadei-public.key" target="_blank">http://www.pegasusnet.com.ar/LeonardoTadei-public.key</a><br><br>_______________________________________________<br>Php-avanzado mailing list<br><a ymailto="mailto:Php-avanzado@pato2.fi.mdp.edu.ar" href="/mc/compose?to=Php-avanzado@pato2.fi.mdp.edu.ar">Php-avanzado@pato2.fi.mdp.edu.ar</a><br><a
 href="http://www3.fi.mdp.edu.ar/cgi-bin/mailman/listinfo/php-avanzado" target="_blank">http://www3.fi.mdp.edu.ar/cgi-bin/mailman/listinfo/php-avanzado</a><br></div></blockquote></div></td></tr></table>