<!DOCTYPE html>
<html lang="cz">  
  <head> 
  <meta charset="UTF-8">
  <meta http-equiv="content-type" content="text/html;charset=utf-8">    
     <title>Wasah</title>         
    <meta name="viewport" content="width=device-width, initial-scale=1.0">         
    <meta charset="UTF-8">    
 </head>
 <body>



<?php
echo $_POST['prodId'];

$target_dir = "files/";
$target_file = $target_dir . $_POST['prodId']. '_' .basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image

// Check if file already exists
if (file_exists($target_file)) {
    echo "Tento soubor již existuje.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Tvůj soubor je větší než povolená velikost.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" &&  $imageFileType != "pdf" &&  $imageFileType != "doc" &&  $imageFileType != "docx" &&  $imageFileType != "xlsx"
&&  $imageFileType != "xls" &&  $imageFileType != "xml" ) {
    echo "Povolené formáty: JPG, JPEG, PNG, PDF, Exel, Word & GIF. ";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Soubor nejde bohužel nahrát..";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Někde se stala chyba při nahrávání souboru, zkus to znova.";
    }
}
     ?> <a href="javascript:history.back()">Zpět</a>  


       </body>
     </html>