久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='ewBeO'></bdo><ul id='ewBeO'></ul>

      <small id='ewBeO'></small><noframes id='ewBeO'>

      <tfoot id='ewBeO'></tfoot>

      <i id='ewBeO'><tr id='ewBeO'><dt id='ewBeO'><q id='ewBeO'><span id='ewBeO'><b id='ewBeO'><form id='ewBeO'><ins id='ewBeO'></ins><ul id='ewBeO'></ul><sub id='ewBeO'></sub></form><legend id='ewBeO'></legend><bdo id='ewBeO'><pre id='ewBeO'><center id='ewBeO'></center></pre></bdo></b><th id='ewBeO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ewBeO'><tfoot id='ewBeO'></tfoot><dl id='ewBeO'><fieldset id='ewBeO'></fieldset></dl></div>

        <legend id='ewBeO'><style id='ewBeO'><dir id='ewBeO'><q id='ewBeO'></q></dir></style></legend>

        上傳多張圖片并將其路徑存儲在數(shù)據(jù)庫中

        Upload multiple images and store their path in database(上傳多張圖片并將其路徑存儲在數(shù)據(jù)庫中)
        <legend id='f9vQU'><style id='f9vQU'><dir id='f9vQU'><q id='f9vQU'></q></dir></style></legend>
      1. <small id='f9vQU'></small><noframes id='f9vQU'>

            <tbody id='f9vQU'></tbody>
          <tfoot id='f9vQU'></tfoot>

            • <bdo id='f9vQU'></bdo><ul id='f9vQU'></ul>
                  <i id='f9vQU'><tr id='f9vQU'><dt id='f9vQU'><q id='f9vQU'><span id='f9vQU'><b id='f9vQU'><form id='f9vQU'><ins id='f9vQU'></ins><ul id='f9vQU'></ul><sub id='f9vQU'></sub></form><legend id='f9vQU'></legend><bdo id='f9vQU'><pre id='f9vQU'><center id='f9vQU'></center></pre></bdo></b><th id='f9vQU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='f9vQU'><tfoot id='f9vQU'></tfoot><dl id='f9vQU'><fieldset id='f9vQU'></fieldset></dl></div>
                  本文介紹了上傳多張圖片并將其路徑存儲在數(shù)據(jù)庫中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在制作一個表格,用戶可以通過它上傳多張圖片.當用戶上傳圖像時,它們會存儲在服務器的文件夾中.直到這里一切正常,但是當我嘗試將圖像的路徑保存在數(shù)據(jù)庫中時,而不是路徑,兩個圖像的名稱僅存儲在一行中.我希望每個圖像的路徑應該存儲在不同的行中.

                  <div class="form-group"><label class="col-md-3 control-label">上傳圖片:</label><div class="col-md-8"><input type="file" id="file" name="support_images[]" multiple accept="image/*"/>

                  <div class="form-group"><label class="col-md-3 control-label"></label><div class="提交"><input class="btn btn-primary" value="保存" type="submit" name="submit">

                  </表單>

                  admin_insert_property_images.php

                  解決方案

                  你的 $filepath 變量和你的 query 必須在你的循環(huán)中.

                  您還使用了與 mysqli_ 函數(shù)不兼容的 mysql_query.

                  這兩個 API 不能混合在一起.使用 mysqli_query 同時將數(shù)據(jù)庫連接傳遞給它.

                  I am making a form through which user can upload multiple images. When the user uploads the images they get stored in the server's folder. Everything works fine till here but when I am trying to save the path of the images in the database then instead of the path, the name of both the images gets stored in one row only. I want that the path of each image should get stored in different row.

                  <form action="admin_insert_property_images.php" method="post" enctype="multipart/form-data">
                      <div class="form-group">
                          <label class="col-md-3 control-label">Upload Image:</label>
                              <div class="col-md-8">
                                  <input type="file" id="file" name="support_images[]" multiple accept="image/*" />
                              </div>
                      </div>
                  
                      <div class="form-group">
                          <label class="col-md-3 control-label"></label>
                              <div class="submit">
                                  <input class="btn btn-primary" value="Save " type="submit" name="submit">
                              </div>  
                      </div>
                  </form>
                  

                  admin_insert_property_images.php

                  <?php
                  $con=mysqli_connect("abc.com","abc","ab","abc");
                  // Check connection
                  if (mysqli_connect_errno()) 
                      {
                          echo "Failed to connect to MySQL: " . mysqli_connect_error();
                      }
                  
                  if(isset($_POST['submit']))           
                  {
                   extract($_POST);
                  
                      if(isset($_FILES['support_images']['name']))
                      {
                          $file_name_all="";
                          for($i=0; $i<count($_FILES['support_images']['name']); $i++) 
                          {
                                 $tmpFilePath = $_FILES['support_images']['tmp_name'][$i];    
                                 if ($tmpFilePath != "")
                                 {    
                                     $path = "propertyimages/"; // create folder 
                                     $name = $_FILES['support_images']['name'][$i];
                                    $size = $_FILES['support_images']['size'][$i];
                  
                                     list($txt, $ext) = explode(".", $name);
                                     $file= time().substr(str_replace(" ", "_", $txt), 0);
                                     $info = pathinfo($file);
                                     $filename = $file.".".$ext;
                                     if(move_uploaded_file($_FILES['support_images']['tmp_name'][$i], $path.$filename)) 
                                     { 
                                        $file_name_all.=$filename."*";
                                     }
                               }
                          }
                          $filepath = rtrim($file_name_all, '*'); 
                  $query=mysqli_query($con,"INSERT into propertyimages (`propertyimage`) VALUES('".addslashes($filepath)."'); ");    
                          }
                          else
                      {
                          $filepath="";
                      }
                  
                      if($query)
                      {
                         header("Location: admin_profile.php");
                      }
                  }
                  ?>
                  

                  解決方案

                  Your $filepath variable and your query has to be in your loop.

                  You are also using mysql_query which is not compatible with mysqli_ functions.

                  Those two APIs do not mix together. Use mysqli_query while passing DB connection to it.

                  <?php
                  $con=mysqli_connect("abc.com","abc","ab","abc");
                  // Check connection
                  if (mysqli_connect_errno()) 
                      {
                          echo "Failed to connect to MySQL: " . mysqli_connect_error();
                      }
                  
                  if(isset($_POST['submit']))           
                  {
                   extract($_POST);
                  
                      if(isset($_FILES['support_images']['name']))
                      {
                          $file_name_all="";
                          for($i=0; $i<count($_FILES['support_images']['name']); $i++) 
                          {
                                 $tmpFilePath = $_FILES['support_images']['tmp_name'][$i];    
                                 if ($tmpFilePath != "")
                                 {    
                                     $path = "propertyimages/"; // create folder 
                                     $name = $_FILES['support_images']['name'][$i];
                                    $size = $_FILES['support_images']['size'][$i];
                  
                                     list($txt, $ext) = explode(".", $name);
                                     $file= time().substr(str_replace(" ", "_", $txt), 0);
                                     $info = pathinfo($file);
                                     $filename = $file.".".$ext;
                                     if(move_uploaded_file($_FILES['support_images']['tmp_name'][$i], $path.$filename)) 
                                     { 
                                        $file_name_all.=$filename."*";
                                     }
                               }
                                $filepath = rtrim($file_name_all, '*').$path;    
                           $query=mysqli_query($con,"INSERT into propertyimages (`propertyimage`) VALUES('".addslashes($filepath)."'); ");
                          }
                  
                      }
                      else
                      {
                          $filepath="";
                      }
                  
                      if($query)
                      {
                         header("Location: admin_profile.php");
                      }
                  }
                  

                  這篇關(guān)于上傳多張圖片并將其路徑存儲在數(shù)據(jù)庫中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調(diào)用未定義的函數(shù) mysqli_result::num_rows())
                  PHP Prepared Statement Problems(PHP 準備好的語句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結(jié)果)
                  PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                  How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)
                • <legend id='8x4OB'><style id='8x4OB'><dir id='8x4OB'><q id='8x4OB'></q></dir></style></legend>
                • <small id='8x4OB'></small><noframes id='8x4OB'>

                    <bdo id='8x4OB'></bdo><ul id='8x4OB'></ul>

                        <tbody id='8x4OB'></tbody>

                        <tfoot id='8x4OB'></tfoot>
                        <i id='8x4OB'><tr id='8x4OB'><dt id='8x4OB'><q id='8x4OB'><span id='8x4OB'><b id='8x4OB'><form id='8x4OB'><ins id='8x4OB'></ins><ul id='8x4OB'></ul><sub id='8x4OB'></sub></form><legend id='8x4OB'></legend><bdo id='8x4OB'><pre id='8x4OB'><center id='8x4OB'></center></pre></bdo></b><th id='8x4OB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8x4OB'><tfoot id='8x4OB'></tfoot><dl id='8x4OB'><fieldset id='8x4OB'></fieldset></dl></div>
                          主站蜘蛛池模板: 在线看片国产精品 | 日日日日操 | 91福利电影在线观看 | 欧美日韩美女 | 欧美亚洲一区二区三区 | 国产精品久久久久久模特 | 最近最新中文字幕 | 国产精品一区在线 | 99久久婷婷国产综合精品电影 | 在线观看中文字幕亚洲 | 久久久观看 | 久久精品91久久久久久再现 | 亚洲va国产日韩欧美精品色婷婷 | 亚洲在线 | 中文字幕免费观看 | 亚洲精品久久 | 久久久成人动漫 | 免费一级黄色录像 | 欧美精品v国产精品v日韩精品 | 免费h视频| 91精品91久久久 | 日韩在线播放第一页 | 久久99精品久久久久久青青日本 | 国产1区2区3区 | 亚洲精品国产a久久久久久 午夜影院网站 | 国产激情在线观看视频 | 中文字幕在线观看一区 | 精品一二三区视频 | 伊人一二三 | 久久国 | 91视频进入 | 欧美精品91 | 久久av一区二区三区 | 国产精品无码久久久久 | 91久久国产综合久久91精品网站 | 日本一区二区三区四区 | 一区二区三区视频在线 | 亚洲精彩视频在线观看 | 成人在线视频一区 | 久久久精品一区 | 久久久不卡网国产精品一区 |