All source code of file upload program_PHP tutorial

WBOY
Release: 2016-07-21 16:02:51
Original
852 people have browsed it

1.upfile.php file



File upload









2.upload.php
//Get the current date information, And concatenate into a string
$datetime = getdate();
$time = implode("",$datetime);
//Construct file name
//$filename="uploadfiles/ ".$time." ".$upfile_name;
$filename="uploadfiles/".$upfile_name;
//Actually store the file on the server
$copymes = copy($upfile,$ filename);
if ($copymes) {
print("File uploaded successfully!
n");
print("File name: $upfile_name
n");
print("Uploaded file size: $upfile_size
n");

}
else print("File upload failed!
n");

if (($upfile_type=="image/gif")||($upfile_type=="image/pjpeg"))
{
//If it is a graphic file format, it will be displayed
echo "< ;p>";
}
?>

3. Please create a directory uploadfiles in the directory where the above file is located

[The copyright of this article is jointly owned by the author and Aosuo.com. If you need to reprint, please indicate the author and source. 】 

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316434.htmlTechArticle1.upfile.php file html body title file upload/title form enctype=multipart/form-data action=upload .php method=post input type=file name=upfile size=10brbr input type=submit value='Up...
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