This commit is contained in:
szabomarton 2024-11-04 13:15:47 +01:00
parent 8f4d9a7671
commit 0334df1ea4
3 changed files with 35 additions and 2 deletions

View File

@ -3,7 +3,40 @@
if ($_SERVER["REQUEST_METHOD"]=="POST"){ if ($_SERVER["REQUEST_METHOD"]=="POST"){
$celkonyvtar = "kepek/"; $celkonyvtar = "kepek/";
$celfajl = $_FILES["kepfajl"]["name"]; $celfajl = $celkonyvtar.$_FILES["kepfajl"]["name"];
var_dump($_FILES["kepfajl"]); $maxmeret = 5 * 1024 * 1024;
$kepkiterjesztes = strtolower(pathinfo($celfajl, PATHINFO_EXTENSION));
$uploadOK = 1;
if(getimagesize($_FILES["kepfajl"]["tmp_name"]) == false){
$uploadOK = 0;
echo "nem kép lett megadva";
}
if($_FILES["kepfajl"]["size"] > $maxmeret){
$uploadOK = 0;
echo "Túl nagy állomány";
}
if($kepkiterjesztes != "jpg" && $kepkiterjesztes != "png"){
$uploadOK = 0;
echo "nem megengedett formátum";
}
if($uploadOK == 1){
if(move_uploaded_file($_FILES["kepfajl"]["tmp_name"],$celfajl)){
$_SESSION["kepek"][] = $celfajl;
}
}
//var_dump($_FILES["kepfajl"]);
} }
if (isset($_SESSION["kepek"])){
foreach($_SESSION["kepek"] as $key => $value){
echo "<img src='$value' style='width: 200px; height: auto;'>";
}
}

BIN
20241024/kepek/langos.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
20241024/kepek/skull_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB