The front-end and back-end codes correspond to each other. The front-end code name corresponds to the background value, and the information that needs to be uploaded is obtained.
The upload process is very simple. Receive the uploaded information, use the move method to transfer the data to the specified location, and then call back after success. Pay attention to the steps:
Related recommendations: "ThinkPHP Tutorial"
Upload your own encapsulation, receive the passed name value, and then obtain the information to delete the image. , just query the corresponding location in the database, delete it without skipping if there is one, and then upload the image to the specified location, and that's it.
The document has some method information about the image path. You can get the path and save it to the specified location in the database. It supports custom folders. If there is no folder method, it will be automatically created;
#Then define the path to read the image, assign it to the page output, and splice the database path to output the image.
The image path output you made by yourself. If the image is not displayed, it is not uploaded. The effect is as follows:
Multiple images The upload method is determined by a name group, which is passed into the method to traverse and upload the file information; this method does not have a fixed name value and cannot be classified into different folders.
In the future, there will be opportunities to encapsulate some methods that can accept multiple name values.
The above is the detailed content of How to upload pictures in thinkphp5. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software