[PHP-DEV] PHP 4.0 Bug #7546: ftp_put error on open any file From: rogeriop <email protected>
Date: 10/31/00

From: rogeriop <email protected>
Operating system: windows nt
PHP version: 4.0.3pl1
PHP Bug Type: FTP related
Bug description: ftp_put error on open any file

Here's my problem,i select a file with de file htlm object, and then i add it to a listbox,when i use the ftp_put in my code the error on open file will occurr.

<?php
if ($HTTP_COOKIE_VARS["CES"]!=""){
  if(getenv("REQUEST_METHOD")!="POST"){ ?>
    <script language="JavaScript">
      function AdicionarArquivo(){
        var opcao=new Option;
        opcao.text=enviar.arquivo.value;
        enviar.arqsped.add(opcao);
        enviar.arquivos.value=enviar.arquivos.value + enviar.arquivo.value + ",";
      }
    </script>
    <html>
    <head>
    <title>C & S - INFORMÁTICA - Enviar Pedidos</title>
    <style>
      <!--
        big{COLOR:GREEN;}
        th{BACKGROUND:BLUE;COLOR:WHITE;FONT-FAMILY:Arial;}
       -->
    </style>
    </head>
      <body background="/images/backmaster.gif">
      <center><big><big>Enviar Pedidos</big></big></center>
      <p align="center">
      <form method="POST" action="/transferir/pedidos/enviarpedidos2.php" name="enviar">
        <p align="center">
        <select size="5" name="arqsped" multiple>
        </select></p>
        <p align="center"><input type="file" name="arquivo"></p>
        <p align="center"><input type="button" value="Adicionar Pedido à Lista" name="B2" onclick="AdicionarArquivo()"></p>
        <p align="center"><input type="submit" value="Enviar Pedidos" name="B1"></p>
        <input type="hidden" value=" " name="arquivos">
      </form>
      <p align="center"><a href="/Transferir/opcoes.asp">Retornar</a></p>
    </head>
    </html>

  <?php
  } else {?>

      <html>
      <head><title>Enviando Arquivos</title></head>
      <body>

      <?php
         //Inicia conexao ftp
         $conexao_ftp=ftp_connect("www.site.com.br",21);
         ftp_login($conexao_ftp,"username","password");
         ftp_chdir($conexao_ftp,"/root/subfolder/subfolder");
         //Atribui a uma array as strings separadas por virgulas
         $arqsped=explode(",",$arquivos);
         $tam=count($arqsped);
         echo "Aguarde...";
         echo "Enviando Pedidos...";
         //Envia os pedidos para o servidor
         for ($i=1; $i<>$tam; $i++)
             {list(,$arqped)=each($arqsped);
              echo "<center>$arqped</center><br>";
              ftp_put($conexao_ftp,basename($arqped),"$arqped",FTP_ASCII);}
         echo "Todos os pedidos foram enviados com êxito!";
         //Encerra a conexao
         ftp_quit($conexao_ftp);
      ?>

      </body>
      </html>

  <?php }
} else {
    header("Location: http://www.site.com.br/Login/loginerror.htm");
}?>

Thanx for any help...

-- 
Edit Bug report at: http://bugs.php.net/?id=7546&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>