Ver Mensaje Individual
  #5 (permalink)  
Antiguo 11/07/2012, 10:52
Avatar de cesar203
cesar203
 
Fecha de Ingreso: enero-2010
Ubicación: LIMA
Mensajes: 27
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Como subir un archivo por url a carpeta 777

ok doc te mando mi archivo PHP


Código PHP:
Ver original
  1. <?php
  2. if($_GET['op']=="subir"){
  3.  
  4. $archivo = $HTTP_POST_FILES['userfile']['name'];
  5. $direccion=$HTTP_POST_FILES['userfile']['tmp_name'];
  6.  
  7.  
  8. $ruta="http://miweb.com/img/";
  9.  
  10.  
  11. // is_uploaded_file - Indica si el archivo se ha subido a través de HTTP POST  
  12.     if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])){
  13.    
  14.     copy($HTTP_POST_FILES['userfile']['tmp_name'],$ruta."$archivo");
  15.    
  16.     echo "El archivo ha sido cargado y es publicado automaticamente \^\^";
  17.     exit;
  18.     }else{
  19.        echo "Ocurrió algún error al subir el fichero. No pudo guardarse.";
  20.      exit;
  21.     }
  22. }
  23. ?>
  24. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  25. <html xmlns="http://www.w3.org/1999/xhtml">
  26. <head>
  27. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  28. <title>Documento sin t&iacute;tulo</title>
  29. </head>
  30.  
  31. <body>
  32. <table align="center" border="0" width="379" height="51">
  33.     <tr>
  34.         <td align="center" height="51" width="373">
  35.        
  36. <form action="subir.php?op=subir" method="post" enctype="multipart/form-data">
  37. Titulo de la foto:
  38. <br />
  39. <input type="text" name="texto" size="20" maxlength="100">
  40. <br>
  41. <br>
  42. Envianos tu foto:
  43. <br>
  44. <input name="userfile" type="file">
  45. <br>
  46. <input type="submit" name="subirfoto" value="Enviar">
  47. </form>
  48.         </td>
  49.     </tr>
  50. </table>
  51. </body>
  52. </html>

me bota este error

Warning: copy(http://miweb.com/img/2012-07-09.txt) [function.copy]: failed to open stream: HTTP wrapper does not support writeable connections in /public_html/subir/subir.php on line 17

bueno ya probe con $HTTP_POST_FILES y $_FILES

Doc tu eres el unico que me puede ayudar .Mi amigo si lo puede hacer pero no me quiere enseñar.Si se puede hacer con Curl Enseñame como hacerlo
Telo agradecere