%PDF-1.4 %Óëéá 1 0 obj <> endobj 3 0 obj <> endobj 4 0 obj <
| Server IP : 212.252.79.165 / Your IP : 216.73.217.172 [ 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/admin/dba/ |
Upload File : |
<?php
ob_start();
include "../lib/include.php";
// Check if image file is a actual image or fake image
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$variation_id = $_GET['selected-variation'];
$sequence = $_POST['sequence'];
$shelf = $_POST['shelf'];
$keys = "sequence='".$sequence."', shelf='".$shelf."'";
foreach($languages as $language){
$title = addslashes($_POST['title_'.$language['key']]);
$keys = $keys.", title_".$language['key']."='".$title."'";
}
echo $update_query = "UPDATE `tbl_product_variation` SET ".$keys." WHERE `id`='".$variation_id."'";
$update_result = $ceha->query($update_query);
$target_dir = "../../images/product/";
$target_file = $target_dir.basename($_FILES["image_url"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$check = getimagesize($_FILES["image_url"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
// Check if file already exists
/*if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}*/
// Check file size
if ($_FILES["image_url"]["size"] > 10000000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif") {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
echo $new_name = uniqid();
$target_file2 = $target_dir.$new_name.".".$imageFileType;
if (move_uploaded_file($_FILES["image_url"]["tmp_name"], $target_file2)) {
echo "The file ".$target_file2. " has been uploaded.";
$update_result = $ceha->query("UPDATE `tbl_product_variation` SET `tech_image_url`='images/product/".$new_name.".".$imageFileType."' WHERE `id`='".$variation_id."'");
} else {
echo "Sorry, there was an error uploading your file.";
}
}
header("Location: ../product-variation-update.php?selected-variation=".$variation_id);
}
ob_end_flush();
?>