奶头挺立呻吟高潮av全片,成人试看120秒体验区,性欧美极品v,A片高潮抽搐揉捏奶头视频

php語言

php使用html5實現多文件上傳實例

時間:2024-09-04 05:32:03 php語言 我要投稿
  • 相關推薦

php使用html5實現多文件上傳實例

  在html沒有出來之前,要實現php多文件上傳比較麻煩,需要在form表單里面添加多個input file域。html5發布以后,我們可以使用input file的html5屬性multiple來實現多文件上傳,需要的朋友可以參考下。

  首先向大家介紹一下html5中file的multiple屬性

  定義和用法:

  multiple 屬性規定輸入字段可選擇多個值。如果使用該屬性,則字段可接受多個值。

  實例:

  <form action="demo_form.asp" method="get">

  Select images: <input type="file" name="img" multiple="multiple" />

  <input type="submit" />

  </form>

  上面實例中的input file 可接受多個文件上傳字段。

  了解了html5中file的multiple屬性,下面我們開始講解使用html5實現多文件上傳。

  實例代碼:

  html:

  <!DOCTYPE html>

  <html>

  <head>

  <meta charset="UTF-8">

  </head>

  <body>

  <form action="my_parser.php" method="post" enctype="multipart/form-data">

  <p><input name="upload[]" type="file" multiple="multiple" /></p>

  <input type="submit" value="Upload all files">

  </form>

  </body>

  </html>

  php代碼:

  for($i=0; $i<count($_FILES['upload']['name']); $i++) {

  //Get the temp file path

  $tmpFilePath = $_FILES['upload']['tmp_name'][$i];

  //Make sure we have a filepath

  if ($tmpFilePath != ""){

  //Setup our new file path

  $newFilePath = "./uploadFiles/" . $_FILES['upload']['name'][$i];

  //Upload the file into the temp dir

  if(move_uploaded_file($tmpFilePath, $newFilePath)) {

  //Handle other code here

  }

  }

  }

  最后,非常感謝大家的閱讀,希望能幫助到大家!

【php使用html5實現多文件上傳實例】相關文章:

jQuery Mobile + PHP實現文件上傳10-20

php中使用jquery uploadify進行多圖片上傳實例09-11

PHP實現大文件上傳源代碼10-21

用PHP實現文件上傳二法09-10

PHP中使用smarty生成靜態文件的實例10-25

php使用ftp函數實現簡單上傳功能10-31

php多圖片上傳的簡單例子10-09

PHP基于CURL進行POST數據上傳實例10-22

php使用GeoIP庫實例08-09

php實現偽靜態的方法實例09-25

主站蜘蛛池模板: 望谟县| 阳西县| 乌鲁木齐市| 绿春县| 临漳县| 毕节市| 桃园县| 米脂县| 青铜峡市| 万宁市| 高淳县| 信宜市| 道孚县| 旅游| 连山| 西盟| 华池县| 疏附县| 新昌县| 神池县| 岚皋县| 交口县| 太仆寺旗| 西乡县| 安泽县| 霍州市| 罗田县| 米易县| 红河县| 安阳市| 泌阳县| 泽普县| 鄂伦春自治旗| 鹤岗市| 东明县| 田林县| 来安县| 迁西县| 惠来县| 台前县| 香格里拉县|