Upload folder to ftp server using php

So, I took @iYETER's code, and wrapped it as a class object.

You can call this code by these lines:

$ftp = new FtpNew["hostname"];

$ftpSession = $ftp->login["username", "password"];

if [!$ftpSession] die["Failed to connect."];

$errorList = $ftp->send_recursive_directory["/local/dir/", "/remote/dir/"];
print_r[$errorList];

$ftp->disconnect[];

It recursively crawls local dir, and places it on remote dir relative. If it hits any errors, it creates a array hierarchy of every file and their exception code [I only capture 2 so far, if it's another error, it throws it default route for now]

The class this is wrapped into:

Chủ Đề