I'm trying to upload a file to an FTP site which is running FTP over SSL. It looks like the script is able to login to the site, but is unable to upload a file. here's the error message:

Curl Err no:7
Curl Error msg:Uploaded unaligned file size (0 out of 325 bytes)

Here's how my script looks:
$uploadfile = "/tmp/testfile.txt";
$fp = fopen ($uploadfile, "r");

$cobj = curl_init();

curl_setopt($cobj, CURLOPT_URL, "ftp://usernameassword@ftp.test.com/testfile.txt");

curl_setopt($cobj, CURLOPT_RETURNTRANSFER,1);
curl_setopt($cobj, CURLOPT_VERBOSE, 1);
curl_setopt($cobj, CURLOPT_UPLOAD, 1);
curl_setopt($cobj, CURLOPT_INFILE, $fp);
curl_setopt($cobj, CURLOPT_TRANSFERTEXT, 1);
curl_setopt($cobj, CURLOPT_FTP_SSL, CURLFTPSSL_ALL);
curl_setopt($cobj, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($cobj, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($cobj, CURLOPT_INFILESIZE, filesize($uploadfile));

$error = curl_exec($cobj);
echo "Curl Err no:" . curl_errno($cobj);
echo "<br>Curl Error msg:" . curl_error($cobj);

Any help on resolving this error message will be greatly appreciated