ThinkPHP5 realizes image upload

According to the picture upload written by the tp5 framework, let’s
not say much, see the effect.
Insert picture description here
First, render the template in the controller and create a new
Insert picture description here
file in index.html. index.html. Note that enctype="multipart/form-data" must be filled in the form. By default, the value of enctype is application/x-www-form-urlencoded, which cannot be used for file upload. Only when multipart/form-data is used can the file data be completely transmitted.

Insert picture description here

The upload is successful and the picture is displayed. Welcome to technical exchanges

Guess you like

Origin blog.csdn.net/qq_44023710/article/details/111086931