Hello,
I have this generic FTP script that im trying use to upload files to our server... I can connect but it wont upload i get this error:
Warning: ftp_put(): Prohibited file name: English/SonoFlux_XL/ in /homedirs/sonotek/public_html/sono-tek.com/pdf_download/uploader.php on line 45
FTP upload has failed!
The path to where the file should be uploaded is specified by a form where the language and the product type of the file is decided. here is the code:
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}
if(isset($_POST['upload'])) {
$language = $_POST['language'];
$category = $_POST['category'];
$product = $_POST['product'];
$description = $_POST['description'];
$revcode = $_POST['revcode'];
$uploadedfile = $_POST['uploadedfile'];
$destination_file = $language . '/' . $product . '/';
// upload the file
$upload = ftp_put($conn_id, $destination_file, $uploadedfile, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
}
// close the FTP stream
ftp_close($conn_id);
and if i change this snippet of code:
$destination_file = $language . '/' . $product . '/';
// upload the file
$upload = ftp_put($conn_id, $destination_file, $uploadedfile, FTP_BINARY);
to:
$filename = basename( $_FILES['uploadedfile']['name']);
$destination_file = $language . '/' . $product . '/' . $filename;
// upload the file
$upload = ftp_put($conn_id, $destination_file, $uploadedfile, FTP_BINARY);
I get this error:
Warning: ftp_put(): Rename/move failure: No such file or directory in /homedirs/sonotek/public_html/sono-tek.com/pdf_download/uploader.php on line 45
Please let me know and thanks in advanced