php - How to insert multiple image file in a row on my database -


enter image description here

if(count($_files['upload']['name']) > 0){       //loop through each file      for($i=0; $i<count($_files['upload']['name']); $i++) {           //get temp file path          $tmpfilepath = $_files['upload']['tmp_name'][$i];           //make sure have filepath          if($tmpfilepath != ""){               //save filename              $shortname = $_files['upload']['name'][$i];               //save url , file              $filepath = "../img/slider/" .$_files['upload']['name'][$i];               //upload file temp dir                          if(move_uploaded_file($tmpfilepath, $filepath)) { $files[] = $shortname;                }          }      }  }  if(is_array($files)){       foreach($files $file){           $file1 = "img/slider/" . $file;          $query = "insert image(image_path,p_number)values('$file1','$number')";         $result3 = $db->insert($query);     }  } 

how can add implode? store in database 1 record only. because generating record each of file file upload.

enter image description here

the first image current database like. , second goal. how can that?

according requirement, can change code this:

if(is_array($files)){         $completefilename = implode(',',$files);               $query = "insert image(image_path,p_number)values('$completefilename','$number')";         $result3 = $db->insert($query); } 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -