Home > php教程 > php手册 > body text

文件上传程序的全部源码

WBOY
Release: 2016-06-21 09:03:11
Original
1038 people have browsed it
1.upfile.php文件



文件上传








2.upload.php

//取得当前日期信息,并连接成为一个字符串
$datetime = getdate();
$time = implode("",$datetime);
//构造文件名
//$filename="uploadfiles/".$time." ".$upfile_name;
$filename="uploadfiles/".$upfile_name;
//将文件实际的存放在服务器上
$copymes = copy($upfile,$filename);
if ($copymes) {
    print("文件上传成功!
n");
    print("文件名:$upfile_name
n");
    print("上传的文件大小:$upfile_size
n");

}
else  print("文件上传失败!
n");

if (($upfile_type=="image/gif")||($upfile_type=="image/pjpeg"))
{
//如果是图形文件格式则显之
echo "

文件上传程序的全部源码";
}
?>

3.请在上面的那个文件所在目录创建一个目录 uploadfiles 就可以了  



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