Posts

Showing posts from May, 2019

Upload multiple images in Codeigniter

First of all, you must create a table images in your database Follow  the following code in your controllers $this -> load -> library ( 'upload' );      foreach ($_FILES[ 'picture' ][ 'name' ] as $key => $value) {       $secure_id = get_secure_id ($id) . rand ( 1 , 100 );       $_FILES[ 'picture_' . $key][ 'name' ] = $_FILES[ 'picture' ][ 'name' ][$key];       $_FILES[ 'picture_' . $key][ 'type' ] = $_FILES[ 'picture' ][ 'type' ][$key];       $_FILES[ 'picture_' . $key][ 'tmp_name' ] = $_FILES[ 'picture' ][ 'tmp_name' ][$key];       $_FILES[ 'picture_' . $key][ 'error' ] = $_FILES[ 'picture' ][ 'error' ][$key];       $_FILES[ 'picture_' . $key][ 'size' ] = $_FILES[ 'picture' ][ 'size' ][$key];   if ( ! empty ($_FILES[ 'picture' ][ 'tmp_name' ][$k