cURL is a best library for file transfer via different types of protocols. cURL supports the transport via POST, GET, FTP upload and much more.
cURL is also able to authenticate on the destination server or website.
How to send files using PHP and cURL
In this tutorial we want to upload a file to other (password protected) remote FTP server using a web form.
<?php
if (isset($_POST['Submit'])) {
if (!empty($_FILES['file']['name'])) {
$ch = curl...