Home > php教程 > php手册 > php实现上传图片文件代码

php实现上传图片文件代码

WBOY
Release: 2016-06-06 19:51:27
Original
1221 people have browsed it

在PHP程序开发中,文件上传是一个使用非常普遍的功能,也是PHP程序员的必备技能之一。值得高兴的是,在PHP中实现文件上传功能要比在Java、C#等语言中简单得多。

代码很简单,,这里我们就不多废话了,直接奉上源码

0) { echo "错误:".$_FILES["file"]["error"]."
"; }else{ echo "upload:".$_FILES["file"]["name"]."
"; echo "type:".$_FILES["file"]["type"]."
"; echo "size:".$_FILES["file"]["size"]."
"; echo "stored in:".$_FILES["file"]["tmp_name"]; } }else{ if (file_exists("weiwei/".$_FILES["file"]["name"])) { echo $_FILES["file"]["name"]."上传成功."; }else{ move_uploaded_file($_FILES["file"]["tmp_name"], "weiwei/" . $_FILES["file"]["name"]); echo "Stored in: " . "weiwei/" . $_FILES["file"]["name"]; } echo "上传成功"; } } ?>

注册表单
姓名: * 文件类型: php实现上传图片文件代码" alt="">

以上所述就是本文的全部内容了,希望大家能够喜欢。

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template