




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
php基礎(chǔ)教程:文件類php基礎(chǔ)教程:文件上傳conn.php:<?php$id=mysql_connect('localhost','root','root');mysql_select_db("db_database12",$id);mysql_query("setnamesgb2312");?>index.php:<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><title>以二進(jìn)制形式上傳文件到數(shù)據(jù)庫(kù)</title><styletype="text/css"><!--body{ margin-left:0px; margin-top:00px; margin-right:0px; margin-bottom:0px;}--></style></head><scriptlanguage="javascript">functionfile1(form1){if(form1.file.value==""){alert("上傳文件不能為空!!");form1.file.focus();return;}form1.submit();}</script><body><tablewidth="462"height="162"border="0"cellpadding="0"cellspacing="0"><tr><tdwidth="140"height="68"> </td><tdwidth="246"> </td><tdwidth="69"> </td></tr><formname="form1"method="post"action="index_ok.php"><tr><tdheight="28"> </td><tdalign="left"valign="middle"><inputname="file"type="file"size="22"></td><td> </td></tr><tr><tdheight="30"> </td><tdalign="center"valign="top"><inputtype="submit"name="Submit"value="提交"onClick="file1(form1);"></td><td> </td></tr></form><tr><tdheight="36"> </td><td> </td><td> </td></tr></table></body></html>function.php:<?phpsession_start();include("conn.php");$data=date("Y-m-d");$file1="file_name1";if($Submit==true){$query=mysql_query("insertintotb_file1(file_name,file_text,data)values('$file1','$file','$data')");if($query==true){echo"文件上傳成功!!";echo"<metahttp-equiv=\"refresh\"content=\"3url=index.php\">";}else{echo"上傳失敗!!";echo"<metahttp-equiv=\"refresh\"content=\"3url=index.php\">";}}?>php基礎(chǔ)教程:文件以二進(jìn)制形式上傳并放入數(shù)據(jù)庫(kù)conn.php:<?php$id=mysql_connect('localhost','root','root');mysql_select_db("db_database12",$id);mysql_query("setnamesgb2312");?>index.php:<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><title>上傳文件到服務(wù)器</title><styletype="text/css"><!--body{ margin-left:00px; margin-top:0px; margin-right:0px; margin-bottom:0px;}--></style></head><body><tablewidth="385"height="185"border="0"cellpadding="0"cellspacing="0"><tr><tdwidth="130"height="85"> </td><tdwidth="200"> </td><tdwidth="55"> </td></tr><formname="form1"method="post"action="index_ok.php"enctype="multipart/form-data"><tr><tdheight="40"> </td><tdalign="center"valign="middle"><inputname="file2"type="file"id="file2"size="15"maxlength="150"></td><td> </td></tr><tr><tdheight="30"> </td><tdalign="center"><inputtype="submit"name="Submit"value="提交"></td><td> </td></tr></form><tr><tdheight="30"> </td><td> </td><td> </td></tr></table></body></html>index_ok.php:<?phpsession_start();include("conn.php");?><?phpif($Submit=="提交"){$data=date("Y-m-d");$file_name="file2";$path='./upfiles/'.$_FILES['file2']['name'];if(move_uploaded_file($_FILES['file2']['tmp_name'],$path)){ $query="insertintotb_file2(file_name,file_text,data)values('$file_name','$path','$data')"; $result=mysql_query($query); if($result=true){ echo"上傳成功!!"; echo"<metahttp-equiv=\"Refresh\"content=\"3;url=index.php?lmbs=文件上傳\">"; }else{echo"文件上傳失敗!!";echo"<metahttp-equiv=\"Refresh\"content=\"3;url=index.php?lmbs=文件上傳\">";}}}?>php基礎(chǔ)教程:把文件上傳到服務(wù)器conn.php:<?php$id=mysql_connect('localhost','root','root');mysql_select_db("db_database12",$id);mysql_query("setnamesgb2312");?>index.php:<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><title>限制大小的文件上傳</title><styletype="text/css"><!--body{ margin-left:00px; margin-top:0px; margin-right:0px; margin-bottom:0px;}--></style></head><body><tablewidth="385"height="185"border="0"cellpadding="0"cellspacing="0"background="image/316.JPG"><tr><tdwidth="130"height="75"> </td><tdwidth="200"> </td><tdwidth="55"> </td></tr><formname="form1"method="post"action="index_ok.php"enctype="multipart/form-data"><tr><tdheight="38"> </td><tdalign="center"valign="middle"><inputname="file3"type="file"id="file3"size="15"maxlength="150"></td><td> </td></tr><tr><tdheight="30"align="right"> </td><tdalign="center"valign="top"><inputtype="submit"name="Submit"value="提交"> </td><td> </td></tr></form><tr><tdheight="42"> </td><td> </td><td> </td></tr></table></body></html>index_ok.php:<?phpsession_start();include("conn.php");?><?phpif($Submit=="提交"){$data=date("Y-m-d");$file_name="files";$filesize=$_FILES['file3']['size'];if($filesize>2000000){echo"對(duì)不起,您上傳的文件超過了規(guī)定的大小!!";echo"<metahttp-equiv=\"Refresh\"content=\"3;url=index.php?lmbs=文件上傳\">將在3秒鐘后返回前頁(yè)...";}else{$path='./upfiles/'.$_FILES['file3']['name'];if(move_uploaded_file($_FILES['file3']['tmp_name'],$path)){ $query="insertintotb_file2(file_name,file_text,data)values('$file_name','$path','$data')"; $result=mysql_query($query); if($result=true){ echo"上傳成功!!"; echo"<metahttp-equiv=\"Refresh\"content=\"3;url=index.php?lmbs=文件上傳\">"; }else{echo"文件上傳失敗!!";echo"<metahttp-equiv=\"Refresh\"content=\"3;url=index.php?lmbs=文件上傳\">";}}}}?>php基礎(chǔ)教程:限制大小的文件上傳conn.php:<?php$id=mysql_connect('localhost','root','root');mysql_select_db("db_database12",$id);mysql_query("setnamesgb2312");?>index.php:<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><title>限制大小的文件上傳</title><styletype="text/css"><!--body{ margin-left:00px; margin-top:0px; margin-right:0px; margin-bottom:0px;}--></style></head><body><tablewidth="385"height="185"border="0"cellpadding="0"cellspacing="0"><tr><tdwidth="130"height="75"> </td><tdwidth="200"> </td><tdwidth="55"> </td></tr><formname="form1"method="post"action="index_ok.php"enctype="multipart/form-data"><tr><tdheight="38"> </td><tdalign="center"valign="middle"><inputname="file3"type="file"id="file3"size="15"maxlength="150"></td><td> </td></tr><tr><tdheight="30"align="right"> </td><tdalign="center"valign="top"><inputtype="submit"name="Submit"value="提交"> </td><td> </td></tr></form><tr><tdheight="42"> </td><td> </td><td> </td></tr></table></body></html>index_ok.php:<?phpsession_star
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 合肥幼兒師范高等??茖W(xué)?!秳?chuàng)新理論與方法》2023-2024學(xué)年第二學(xué)期期末試卷
- 新疆政法學(xué)院《新聞算法與編程》2023-2024學(xué)年第二學(xué)期期末試卷
- 天津渤海職業(yè)技術(shù)學(xué)院《衛(wèi)星通信系統(tǒng)》2023-2024學(xué)年第二學(xué)期期末試卷
- 四川國(guó)際標(biāo)榜職業(yè)學(xué)院《建筑工程造價(jià)管理》2023-2024學(xué)年第二學(xué)期期末試卷
- 內(nèi)蒙古大學(xué)《新能源汽車概論》2023-2024學(xué)年第二學(xué)期期末試卷
- 2024屆河北省石家莊二中實(shí)驗(yàn)學(xué)校高三下學(xué)期仿真模擬歷史試卷
- 2024-2025學(xué)年山東省聊城市第二中學(xué)高一上學(xué)期12月月考?xì)v史試卷
- 新疆醫(yī)科大學(xué)《高層建筑智慧施工》2023-2024學(xué)年第二學(xué)期期末試卷
- 廣州科技貿(mào)易職業(yè)學(xué)院《建筑CAD》2023-2024學(xué)年第二學(xué)期期末試卷
- 嶺南師范學(xué)院《高電壓技術(shù)實(shí)驗(yàn)》2023-2024學(xué)年第二學(xué)期期末試卷
- GB∕T 28575-2020 YE3系列(IP55)三相異步電動(dòng)機(jī)技術(shù)條件(機(jī)座號(hào)63~355)
- 2022醫(yī)院設(shè)備科工作制度
- 【23精品】蘇少小學(xué)美術(shù)三下教案全冊(cè)
- 房屋租賃(出租)家私清單
- 倉(cāng)儲(chǔ)貨架ppt課件
- 《保健按摩師》(五級(jí))理論知識(shí)鑒定要素細(xì)目表
- 陳日新腧穴熱敏化艾灸新療法上篇
- PID烙鐵恒溫控制器設(shè)計(jì)與制作_圖文
- wincc全套腳本總結(jié)
- 簡(jiǎn)易瞬態(tài)工況法1
- 中國(guó)鐵路總公司環(huán)境保護(hù)管理辦法(鐵總計(jì)統(tǒng)〔2015〕260號(hào))
評(píng)論
0/150
提交評(píng)論