I created a regular upload function with CURL in PHP that uploads a file to a ftp server with authentication. My goal is to call this function over AJAX. Is it possible that this function returns a percentage of how much of the file it already uploaded to the server so that a progress bar could be built.
$ch = curl_init();
$localfile = './test.jpg';
$fp = fopen($localfile, 'r');
curl_setopt($ch, CURLOPT_URL, 'sftp://0.0.0.0/upload/test.jpg');
curl_setopt($ch, CURLOPT_USERPWD, "user:password");
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));