PHP & FTP

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Hoe verstuur je bestanden in PHP via FTP? De belangrijkste opties:

  • Mbv. de file module - Voor recht-toe-recht-aan-toepassingen
  • Mbv. de FTP module - Voor mysterieuze en complexe situaties.

Voorbeeld

<?php

$host = "example.com";
$port = 21;
$user="jip";
$password="**********";

$connection = ftp_connect($host);
$login = ftp_login($connection, $user, $password);
ftp_pasv($connection, true); // Cruciaal!

echo "ftp_connection: $connection \n";
echo "ftp_login: $login \n";

$directory = ftp_nlist($connection,".");
var_dump($directory);

ftp_put($connection, "test-03.xml", "test-03.xml", FTP_ASCII)

?>

Bronnen