0

Here is my html code:

<!DOCTYPE html>
<html>
<head></head>
    <body>      
        <form enctype="multipart/form-data" action="uploadStranica.php" method="POST">
            <input name="fajl" type="file"><br/>
            <input type="submit" value="Upload">
        </form>
    </body>
</html>

and php code:

<?php
    $target_dir = "upload/";
    $target_file = $target_dir . basename($_FILES["fajl"]["name"]);
    // basename daje ime fajla koji je uploadovan;
    if(move_uploaded_file($_FILES["fajl"]["tmp_name"], $target_file))
    {
        echo "Successful upload!";
    }
    else {
        echo "File not found!";
    }

?>

When I open my html file I can see "Choose file" and "Upload". However, after I choosed my file I click on upload button but it shows my php code. Does anyone now anything that can help?

0 Answers0