Insert Mysql Automatic Data

Asked

Viewed 114 times

1

Boa Noite Amigos,

I am looking for a way to register a field for Example Upload that every time a PDF file falls inside a Scanner folder in the FTP hosting it records in the flock this PDF extension file,

Is that possible? Someone has already developed something like this?

  • Good morning buddy, your question is not exactly about mysql. What would be the operating system? do you have root on the machine? what programming language you have available?

1 answer

0

Using PHP, you can create a script that connects to the FTP server and reads the files. Here you have an example of connection using the ftp_connect function

$servidor = 'endereco_do_servidor'; 
$usuario = 'usuario'; // Usuário
$senha = 'senha'; // Senha
$ftp = ftp_connect($servidor); // Retorno: true ou false

In this tutorial you have a step-by-step explanation of how it works:

http://blog.thiagobelem.net/conexao-via-ftp-com-o-php

In this other Stack Overflow post you have a more complete example, where you take the last file and write its name in the database:

https://stackoverflow.com/questions/20800625/how-to-get-latest-modified-csv-file-values-from-ftp-server-and-insert-it-into-my

Note that these solutions are not automatic, IE, would have to manually run your PHP script. To run a script periodically, this will depend on your server’s operating system. In Windows, you use the Task Scheduler, in Unix environments if you use Cronjobs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.