Home > Backend Development > PHP Tutorial > Program source code to implement file upload_PHP tutorial

Program source code to implement file upload_PHP tutorial

WBOY
Release: 2016-07-13 17:37:01
Original
930 people have browsed it



File upload interface


if($UploadAction){
$UploadAction=0;
$TimeLimit=60;
/*Set the default timeout limit time to 30s. When set to 0, there is no time limit*/
set_time_limit($TimeLimit);
If(($Upfile != "none")&&
($Upfile != ""))
{
$Filepath="d:webwebphp est"; //Upload file storage path
$FileName=$Filepath.$Upfile_name;
if($Upfile_size <1024) //Upload file size
{ $FileSize = (string)$Upfile_size . "bytes";}
elseif($Upfile_size <(1024 * 1024))
{
$FileSize = number_format((double)($Upfile_size / 1024 ), 1) . " KB";
}
else
{
$FileSize = number_format((double)($Upfile_size/(1024*1024)),1)."MB";
}
if(!file_exists($FileName))
{
if(copy($Upfile,$FileName))
{unlink($Upfile);
echo "< ;br>
";
echo "File $Upfile_name has been uploaded successfully! ";
echo "

";
echo "File location: $FileName";
echo "

";
echo "File size: $FileSize";
echo "

";
}
else
{echo "File $Upfile_name failed to upload! "; }
}
else
{echo "The file $Upfile_name already exists! "; }
}
else
{echo "You did not select any files to upload! "; }
set_time_limit(30); //Restore the default timeout setting
}
?>

ACTION = "default.php" METHOD = "POST">



< ;/TR>



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486618.htmlTechArticleHTML HEAD TITLE file upload interface/TITLE /HEAD BODYTABLECENTER ? if($UploadAction){ $UploadAction=0; $ TimeLimit=60; /*Set the default timeout limit time to 30s. When set to 0, it is not...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template