upload txt file with ftp with php

0

How can we set up a file upload script, so it "sees" a local directory where I have the files I need to upload. I'm not a form but I need to do it via ftp, when I enter the page the same would have to "see" the local folder and upload the files that already have in the folder. Is there a way to set the "path" for this to happen? I am using a script in php. The script I'm using is the one I copied from thiagobelem.net:

// Dados do servidor
    $servidor   =   '';
    $usuario    =   ''; 
    $senha      =   ''; 

// Abre a conexão com o servidor FTP
    $ftp=   ftp_connect($servidor); 

// Faz o login no servidor FTP
    $login  =   ftp_login($ftp, $usuario, $senha); 

// Define variáveis para o envio de arquivo
    $local_arquivo  =   './arquivos/documento.doc'; // pasta (local)
    $ftp_pasta      =   '/public_html/arquivos/'; // Pasta (externa)
    $ftp_arquivo    =   'documento.doc'; // Nome do arquivo (externo)

// Envia o arquivo pelo FTP em modo ASCII
    $envio  =   ftp_put($ftp, $ftp_pasta.$ftp_arquivo, $local_arquivo, FTP_ASCII);

// Encerra a conexão ftp
    ftp_close($ftp);

When I enter the upload page, how can I make this variable

$local_arquivo

may already be the path of the files, and can I access this page on any machine? Would you have to have the machine with these special permission files in the folder to access it that way?

    
asked by anonymous 26.06.2018 / 21:01

0 answers