I can't seem to figure this out. Using the code you published I keep receiving the error:
error code 6 (my handler identifies the error)
The code:
if (isset($_POST['file_name'])) {
if (!empty($_FILES['file_name']['name'])) {
$ch = curl_init();
$localfile = $_FILES['file_name']['tmp_name'];
$fp = fopen($localfile, 'r');
curl_setopt($ch, CURLOPT_URL, 'ftp://loginname@domain.com:password@ftp.domain.com/'. $directory_result['directory'] . '/' . $_FILES['file_name']['name']);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
curl_exec ($ch);
$error_no = curl_errno($ch);
curl_close ($ch);
if ($error_no == 0) {
$error = 'File uploaded succesfully.';
} else {
$error = 'There was an error uploading your file. Please refer to error code '. $error_no . '.';
}
} else {
$error = 'Please select a file.';
}
}
I want to think it is a problem with the user name - the ftp account is a sub account that requires the @ symbol.
Any thoughts, any more detail needed let me know
Kevin