search
HomePHP FrameworkThinkPHPHow to upload pictures in thinkphp5

How to upload pictures in thinkphp5

Aug 23, 2019 pm 01:48 PM
thinkphp5upload image

How to upload pictures in thinkphp5

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.

How to upload pictures in thinkphp5

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:

How to upload pictures in thinkphp5

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.

How to upload pictures in thinkphp5

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;

How to upload pictures in thinkphp5

#Then define the path to read the image, assign it to the page output, and splice the database path to output the image.

How to upload pictures in thinkphp5

The image path output you made by yourself. If the image is not displayed, it is not uploaded. The effect is as follows:

How to upload pictures in thinkphp5

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.

How to upload pictures in thinkphp5

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

MinGW - Minimalist GNU for Windows

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

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

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