.
*/
// hide all error
error_reporting(0);
if (!isset($_SESSION["mikhmon"])) {
header("Location:../admin.php?id=login");
} else {
if (isset($_POST["submit"])) {
$logo_dir = "./img/";
$logo_file = $logo_dir . basename($_FILES["UploadLogo"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($logo_file, PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
$check = getimagesize($_FILES["UploadLogo"]["tmp_name"]);
if ($check !== false) {
if ($currency == in_array($currency, $cekindo['indo'])) {
$galat = '
Alert!
File name is : ' . basename($_FILES["UploadLogo"]["name"]) . '.
';
} else {
$galat = ' Alert!
File name is : ' . basename($_FILES["UploadLogo"]["name"]) . '.
';
}
$uploadOk = 1;
} else {
if ($currency == in_array($currency, $cekindo['indo'])) {
$galat = ' Alert!
File bukan gambar.
';
} else {
$galat = ' Alert!
File is not an image.
';
}
$uploadOk = 0;
}
// Check file size
if ($_FILES["UploadLogo"]["size"] > 2000000) {
if ($currency == in_array($currency, $cekindo['indo'])) {
$galat = ' Alert!
Ukuran file terlalu besar.
';
} else {
$galat = ' Alert!
File is too large.
';
}
$uploadOk = 0;
}
// Allow certain file formats
if (basename($_FILES["UploadLogo"]["name"] != "logo-" . $session . ".png")) {
if ($currency == in_array($currency, $cekindo['indo'])) {
$galat = ' Alert!
Hanya bisa upload logo-' . $session . '.png.
';
} else {
$galat = ' Alert!
Only logo-' . $session . '.png are allowed.
';
}
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
if ($currency == in_array($currency, $cekindo['indo'])) {
$galat = ' Alert!
File tidak diupload. Nama file harus logo-'.$session.'.png
';
} else {
$galat = ' Alert!
File was not uploaded. File name must be logo-'.$session.'.png
';
}
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["UploadLogo"]["tmp_name"], $logo_file)) {
if ($currency == in_array($currency, $cekindo['indo'])) {
$galat = ' Alert!
Success! File ' . basename($_FILES["UploadLogo"]["name"]) . ' telah diupload.
';
} else {
$galat = ' Alert!
Success! The File ' . basename($_FILES["UploadLogo"]["name"]) . ' has been uploaded.
';
}
} else {
if ($currency == in_array($currency, $cekindo['indo'])) {
$galat = ' Alert!
Terjadi masalah ketika upload file. Nama file harus logo-'.$session.'.png
';
} else {
$galat = ' Alert!
There was an error uploading your file. File name must be logo-'.$session.'.png
';
}
}
}
//echo "";
}
}
?>