%PDF-1.4 %Óëéá 1 0 obj <> endobj 3 0 obj <> endobj 4 0 obj <
| Server IP : 212.252.79.165 / Your IP : 216.73.216.24 [ Web Server : Apache System : Linux 212-252-79-165.cprapid.com 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 User : cehaburo ( 1001) PHP Version : 8.1.33 Disable Function : exec,passthru,shell_exec,system Domains : 48 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/cehaburo/www/ |
Upload File : |
<?php
include 'connection.php';
// FTP konfigürasyon bilgileri
$ftp_server = "file.cehaburo.com";
$ftp_username = "ftpceha";
$ftp_password = "Aa123456!!!!**test";
$ftp_dir = "/product-pdf/";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login_result = ftp_login($ftp_conn, $ftp_username, $ftp_password);
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_FILES["fileToUpload"])) {
$categoryId = $_POST["categoryId"];
$productId = $_POST["productId"];
$variationId = $_POST["variationId"];
$uploadDirectory = 'pdf/';
$file = $_FILES["fileToUpload"];
$fileSize = $file["size"];
$fileName = basename($file["name"]);
$tempFilePath = $uploadDirectory . $fileName;
if ($file["error"] === UPLOAD_ERR_OK) {
if (move_uploaded_file($file["tmp_name"], $tempFilePath)) {
$remote_file_path = $ftp_dir . $fileName;
if (ftp_put($ftp_conn, $remote_file_path, $tempFilePath, FTP_BINARY)) {
echo '<script>alert("FTP\'ye dosya başarıyla yüklendi.");</script>';
$sql = "INSERT INTO tbl_product_pdf (category_id, product_id, variation_id, file_name, file_size, file_path) VALUES (?, ?, ?, ?, ?, ?)";
$stmt = $ceha->prepare($sql);
$stmt->bind_param("iiisds", $categoryId, $productId, $variationId, $fileName, $fileSize, $remote_file_path);
if ($stmt->execute()) {
echo '<script>alert("Dosya başarıyla yüklendi ve veritabanına eklendi.");</script>';
} else {
echo '<script>alert("Veritabanına ekleme sırasında bir hata oluştu.");</script>';
}
} else {
echo '<script>alert("FTP\'ye dosya yüklenirken bir hata oluştu.");</script>';
}
unlink($tempFilePath);
} else {
echo '<script>alert("Dosya taşınırken bir hata oluştu.");</script>';
}
} else {
echo '<script>alert("Dosya yüklenirken bir hata oluştu.");</script>';
}
}
ftp_close($ftp_conn);
?>