Jump to content

LibCURL error while sending file to FTP / SSL site


cajedi

Recommended Posts

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://[email protected]/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);

curl_close($cobj);

exit;

 

=========================================================

Any help on resolving this error message will be greatly appreciated

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.