You need to get the name of the file and transfer it to the handler in php. I'm trying to do this:

<form id="ff" enctype="multipart/form-data" method="POST" action="addbufs.php"> <p><input type="file" name="fn" form="ff"></p> <p><input id="but" type="submit" value="Загрузить"></p> </form> 

while in the addbufs.php handler in $var = $_POST["fn"]; empty, the presence / absence of id="ff" does not affect the result. When using the method GET works fine. Using the POST method in other cases does not cause any problems. I use Denver.

What could be the problem? Thanks for the answer.

    2 answers 2

    Instead of $ _POST, use $ _FILES

    • when using $ _FILES instead of the file name, I get Array - Anatoly
    • make print_r ($ _ FILES) and everything will be clear at once - Andrey Pilyugin

    I think you should try this:

     echo $_FILES['fn']['name'];