search
Homephp教程PHP源码php 文件上传实例代码

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


if(!$UploadAction):
?>

 代码如下 复制代码



文件上载界面


















else:
?>



文件上载代码

 代码如下 复制代码


$UploadAction=0;
echo "Good!";
$TimeLimit=60; /*设置超时限制时间 缺省时间为30秒 设置为0时为不限时 */
set_time_limit($TimeLimit);

If(($UploadFile !="none" ))
{  
    $UploadPath=AddSlashes(dirname($PATH_TRANSLATED))."\www.111cn.net\"; //上载文件存放路径

    $FileName=$UploadPath.$UploadFile_name; //上载文件名

    if($UploadFile_size     {
  $FileSize=(string)$UploadFile_size." 字节"; 
 }
     elseif ($UploadFile_size      {
  $FileSize=number_format((double)($UploadFile_size/1024), 1) . " KB";
     }
  else{
  $FileSize=number_format((double)($UploadFile_size / (1024 * 1024)), 1) . " MB";
     }
   
    if(!file_exists($FileName))
    {
         if(copy($UploadFile,$FileName))
         {  echo "文件 $UploadFile_name ($FileSize)上载成功!"; }
         else
         { echo "文件 $UploadFile_name上载失败!"; }

         unlink($UploadFile);
    }
    else
    { echo "文件 $UploadFile_name已经存在!"; }
}
else
{ echo "你没有选择任何文件上载!"; }

set_time_limit(30); //恢复缺省超时设置

?>


返回



endif;
?>

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Atom editor mac version download

Atom editor mac version download

The most popular open source editor