Подскажите пожалуйста, есть такой код:
<form enctype='multipart/form-data' action='/fun/editcontact.php' method='post'>
<td style='border-bottom: 1px solid #e0e0e0;'><span style='display: inline-block;margin-left:10px;margin-right:15px;'><i style='margin-right:15px; font-size:20px; color:#737373;' class='far fa-image'></i>Фото: </span><input style='border-bottom: 0px solid #737373;float:right;height:auto;margin-right: -25px; name='userfile' type='file'><input type='hidden' name='file_name' value='".$row['id']."'><input type='hidden' name='MAX_FILE_SIZE' value='3000000'></td>
</form>
И php:
<?php
$uploaddir = '/home/uploads/contacts/';
$ext = pathinfo($_FILES['userfile']['name'], PATHINFO_EXTENSION);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_POST['file_name'] . '.jpg'))
{
print "File is valid, and was successfully uploaded.";
} else {
print "There some errors!";
}
header("Location: *");
?>
Когда заливаю файл eror log выдает такую ошибку.
[05-Nov-2018 08:23:49 UTC] PHP Notice: Undefined index: userfile in /home/editcontact.php on line 16
[05-Nov-2018 08:23:49 UTC] PHP Notice: Undefined index: userfile in /home/editcontact.php on line 17 В чем может быть проблема? Спасибо.
$_FILES
и глазками своими посмотрите какие в нем значения.