Please tell me there is such a code:
<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> And 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: *"); ?> When I upload an eror log file, I get this error.
[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 What could be the problem? Thank.
$_FILESand see with your eyes what values it contains. - u_mulder