Hello everyone, please tell me what is wrong.

There is a POST form, primitive, waiting for 1 file

<div class="row"> <div class="col-md-8"> <?php // UPLOAD_ERR_OK | Значение: 0; Ошибок не возникало, файл был успешно загружен на сервер. if ($_FILES && $_FILES['filename']['error']== UPLOAD_ERR_OK) { $name = $_FILES['filename']['name']; move_uploaded_file($_FILES['filename']['tmp_name'], $name); echo "Файл загружен"; } ?> </div> <div class="col-md-offset-1 col-md-3"> <form method="post" enctype="multipart/form-data"> <div class="form-group"> <label for="exampleInputFile">Пожалуйтса, загрузите текстовый файл</label> <input type="file" name="filename" id="exampleInputFile"> <p class="help-block">Вы сможете загрузить только текстовые документы</p> </div> <button type="submit" class="btn btn-default">Загрузить на сервер</button> </form> </div> </div> 

But I never see the echo lines, which means the file is never uploaded to the server ... what to do? (Yes, and in the folder with the project it is missing.

  • which folder do you move it to? The $name probably does not contain the full path with the directory, but just the name. - teran
  • by default to the root folder of the project, I will create different directories later - Kryshtop
  • insert print_r($_FILES); before checking print_r($_FILES); It is quite possible that $ _FILES ['filename'] is an array, and you need to use $_FILES['filename'][0]['error'] == UPLOAD_ERR_OK - P. Fateev
  • display_errors and error_reporting(E_ALL) to help you, comment above. - teran

0