I want to upload multiple images but image is not submitting to the database


#1

I want to upload multiple images but image is not submitting to the database .
I’m following https://github.com/Panopath/ionic2-multi-image-upload/blob/master/src/components/multi-image-upload/multi-image-upload.ts this code and my php code is look like this below is my php code

mysql_connect("localhost","abcd","xxxxxx") or die("mysql not coneected".mysql_error());
mysql_select_db("mydbname");

if(count($_FILES["files"]["name"]) > 0)
{
 //$output = '';
 for($count=0; $count<count($_FILES["files"]["name"]); $count++)
 {
  $file_name = $_FILES["files"]["name"][$count];
  $tmp_name = $_FILES["files"]['tmp_name'][$count];
  $file_array = explode(".", $file_name);
  $file_extension = end($file_array);
  if(file_already_uploaded($file_name, $connect))
  {
   $file_name = $file_array[0] . '-'. rand() . '.' . $file_extension;
  }
  $location = 'files/' . $file_name;
  if(move_uploaded_file($tmp_name, $location))
  {
   $query = "
   INSERT INTO testImage (image) 
   VALUES ('".$file_name."')
   ";
   $statement = $connect->prepare($query);
   $statement->execute();
  }
 }
}

please help me out how can i fix it.
Thanks


#2

Wow great ! I’ve been create a new topic four hours ago.There is no response.


#3

I hear Google operates a decent search engine. It’s possible someone, at some point in time has posted something on the internet related to this.