When I try to display a form, it is $form->prepare(); should display

 <form name="upload-form" id="upload-form" method="post" enctype="multipart/form-data"> <div class="form-element"> <label for="image-file">Avatar Image Upload</label> <input type="file" name="image-file" id="image-file"> </div> <button>Submit</button> </form> 

But I have displayed

 <form name="upload-form" id="upload-form" method="post"> <div class="form-element"> <label for="image-file">Avatar Image Upload</label> <input type="file" name="image-file" id="image-file"> </div> <button>Submit</button> </form> 

Why doesn't it display enctype? When I don’t specify the manual $this->setAttribute('enctype', 'multipart/form-data') , the file loading does not work for me, and the file name is entered into the table (DB). When I specify the encoding, I do not put the file name in the table (Column '...' cannot be null), but for that the file is uploaded to the "server"

  • Can you see the form class? The official documentation says that the enctype will be added to the form AUTOMATICALLY if there is a FileFileld - Hlogeon
  • Yes, redid a little. Upload file not working - MoOgur
  • So you can see the form class itself?) - Hlogeon

0