1

I'm not so familiar with PHP, but i'm learning and trying to make an input field which uploads image to my server.

On HTML side i'll post to another file:

<form method="post" action="functions.php" class="form-horizontal" onsubmit="return validateForm()">
    <input type="file" name="pilt">
    <button type="submit" name="submitform">
</form>

Actually form has a lot more components which are posted along with them, but for simplicity, i've left them out (every other element is posted as needed).

In the functions.php:

if(isset($_POST['submitform'])){
    $name = basename($_FILES['pilt']['name']);
    echo $name;
}

then nothing is printed, meaning that $name is empty. I followed this guide, but as already naming fails then obviously fails other code as well. Can anyone point out why this does not work?

Banana
  • 814
  • 1
  • 8
  • 28

0 Answers0