I am trying to use PHP cURL to upload and overwrite a CSV on my ftp server.
It runs and gives me no error but when I go on the FTP, it hasn't uploaded anything. I have removed the username and pass from below but they would be filled out.
$url4 = "ftp://username:password@ip/folder/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url4);
$postData = array(
'testData' => '@csv/output/list.csv',
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
// upload file
if (curl_exec($ch))
{
echo "Successfully uploaded.<br />";
}
else
{
echo "Error uploading.<br />";
}
// close connection
curl_close ($ch);
//End of Uploading the FTP file