search
Homephp教程PHP源码php文件上传与move_uploaded_file简介

<script>ec(2);</script>

缩略图:
 

php处理代码

 

 $temp_name = $_files[files][tmp_name];            //临时文件3         

$now_name  = $_files[files][name];                    //当前文件4         

move_uploaded_file($temp_name,'./images/'.date('yyyymdhis').$now_name);    //移动到指定的文件夹下面

 ?>

move_uploaded_file() 函数将上传的文件移动到新位置。

若成功,则返回 true,否则返回 false。

语法
move_uploaded_file(file,newloc)参数 描述
file 必需。规定要移动的文件。
newloc 必需。规定文件的新位置。

说明
本函数检查并确保由 file 指定的文件是合法的上传文件(即通过 php 的 http post 上传机制所上传的)。如果文件合法,则将其移动为由 newloc 指定的文件。

如果 file 不是合法的上传文件,不会出现任何操作,move_uploaded_file() 将返回 false。

如果 file 是合法的上传文件,但出于某些原因无法移动,不会出现任何操作,move_uploaded_file() 将返回 false,此外还会发出一条警告。

这种检查显得格外重要,如果上传的文件有可能会造成对用户或本系统的其他用户显示其内容的话。

 

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

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools