欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php實(shí)現(xiàn)表單提交上傳文件功能

 更新時(shí)間:2018年05月28日 17:02:53   作者:bboyjoe  
這篇文章主要為大家詳細(xì)介紹了php實(shí)現(xiàn)表單提交上傳文件功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了php實(shí)現(xiàn)表單提交上傳文件功能的具體代碼,供大家參考,具體內(nèi)容如下

首先創(chuàng)建含表單的html文件:upload.html

<!DOCTYPE html> 
<html> 
<head lang="en"> 
 <meta charset="UTF-8"> 
 <title>上傳文件</title> 
</head> 
<body> 
<form action="upload.php" method="post" enctype="multipart/form-data"> 
 <input type="file" name="file"/> 
 <input type="submit" value="提交"> 
</form> 
</body> 
</html> 

再創(chuàng)建服務(wù)端文件:upload.php

<!DOCTYPE html> 
<html> 
<head> 
 <meta charset="UTF-8"> 
 <title>顯示文件</title> 
</head> 
<body> 
<?php 
 
//print_r($_FILES); 
 
//獲取到臨時(shí)文件 
$file=$_FILES['file']; 
//獲取文件名 
$fileName=$file['name']; 
//移動(dòng)文件到當(dāng)前目錄 
move_uploaded_file($file['tmp_name'],$fileName); 
 
//顯示文件 
echo "<img src='$fileName'>"; 
?> 
</body> 
</html> 

點(diǎn)擊提交后呈現(xiàn)出文件:

本文已被整理到了《php文件上傳操作匯總》 ,更多精彩內(nèi)容,歡迎大家學(xué)習(xí)閱讀。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論