PHP multi-file upload component_PHP tutorial

WBOY
Release: 2016-07-20 11:09:30
Original
1458 people have browsed it




php tutorial multi-file upload component
< ;/head>


< !--Text used in the video-->


 

缩略图模式


这个选择框的数据将以post形式和图片一起传送到服务器
 
   
   

   

  改变窗口:高

     
     
     





   
 
   
   
   
 



php processing file

// Note: use When uploading components, you cannot use $_files["filedata"]["type"] to determine the file type
mb_http_input("utf-8");
mb_http_output("utf-8");

//--------------------------------------------- --------------------------------------------------
//Instance code when the component sets a.md5file to 2 and 3

if(getget('access2008_cmd')=='2'){ // Submit the md5 verified file information for verification
//getget("access2008_file_name") 'File name
//getget("access2008_file_size") 'File size in bytes
//getget("access2008_file_type") 'File type such as .gif .png
//getget("access2008_file_md5") 'The md5 signature of the file

die('0'); //Return command 0 = Start uploading the file, 2 = Do not upload the file, the front desk directly displays the upload completion
}
if(getget('access2008_cmd')=='3'){ //Submit file information for verification
//getget("access2008_file_name") 'File name
//getget("access2008_file_size ") 'File size in bytes
//getget("access2008_file_type") 'File type such as .gif .png

die('1'); //Return command 0 = Start uploading files ,1 = Submit the file information after md5 verification for verification, 2 = Do not upload the file, the front desk directly displays the upload completion
}
//----------------- -------------------------------------------------- --------------------------

$type=filekzm($_files["filedata"]["name"]) ;
if ((($type == ".gif")
|| ($type == ".png")
|| ($type == ".jpeg")
|| ($type == ".jpg")
|| ($type == ".bmp"))
&& ($_files["filedata"]["size"] < 200000))
{
if ($_files["filedata"]["error"] > 0)
{
echo "Return error: " . $_files["filedata"]["error" ] . "
";
}
else
{
echo "Uploaded files: " . $_files["filedata"]["name"] . "< br />";
echo "File type: " . $type . "
";
echo "File size: " . ($_files["filedata"]["size" ] / 1024) . " kb
";
echo "Temporary file: " . $_files["filedata"]["tmp_name"] . "
";

if (file_exists( $_files["filedata"]["name"]))
{
echo $_files["filedata"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_files["filedata"]["tmp_name"],
'./'.$_files["filedata"]["name"]);
echo "stored in: " . $_files["filedata"]["name"]."
";
echo "md5 validation:".getget("access2008_file_md5")."< ;br />";
echo "
Upload successful! What you selected is".getpost("select")."--".getpost("select2" )."";
}
}
}
else
{
echo "Upload failed, please check whether the file type and file size meet the standards< br />File type: ".$type.'
File size:'.($_files["filedata"]["size"] / 1024) . " kb";
}

function filekzm($a)
{
$c=strrchr($a,'.');
if($c)
{
return $c;
}else{
return '';
}
}

function getget($v)// Get get
{
if(isset($_get [$v]))
{
return $_get[$v];
}else{
return '';
}
}

function getpost ($v)// Get post
{
if(isset($_post[$v]))
{
return $_post[$v];
}else{
return '';
}
}
?>

Source code package download
http://down.php100.com/php/2011/0311/22880.html


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444791.htmlTechArticlehtml xmlns=http://www.w3.org/1999/xhtml xml:lang=zh_cn lang=zh_cn head meta http-equiv=content-type content=text/html; charset=utf-8 / titlephp tutorial multi-file upload component/title /h...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!