Multiple File Upload In Codeigniter And Php

June 29th, 2012 | 1 Comment | Posted in Php & MySql

Multiple file upload in codeigniter :
After Searching in web I have not found approprite tutorial on how to upload multiple file in Php/Codeigniter

The view File:

ldquo;-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>



var table = document.getElementById(tableID);

var rowCount = table.rows.length;
var row = table.insertRow(rowCount);

var colCount = table.rows[0].cells.length;

for(var i=0; i

var newcell = row.insertCell(i);

newcell.innerHTML = table.rows[0].cells[i].innerHTML;
//alert(newcell.childNodes);
switch(newcell.childNodes[0].type) {
case “text”:
newcell.childNodes[0].value = “”;
break;
case “checkbox”:
newcell.childNodes[0].checked = false;
break;
case “select-one”:
newcell.childNodes[0].selectedIndex = 0;
break;
}
}
}

function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;

for(var i=0; i var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
if(rowCount alert(“Cannot delete all the rows.”);
break;
}
table.deleteRow(i);
rowCount–;
i–;
}

}
}catch(e) {
alert(e);
}
}


Multi File Upload























Multi File Upload

 

 



 

The Controler :

load->model(‘commoncall’);

}

function submit()
{
if($this->input->post(‘submit_member’))
{

//—Save Detail
$dir_name = $this->input->post(‘dir_name’,TRUE);
$dir_mobile = $this->input->post(‘mobile’,TRUE);
$dir_blood = $this->input->post(‘bgroup’,TRUE);
$dir_designation = $this->input->post(‘designation’,TRUE);
$dir_photo = $_FILES['userfile'];

$n=count($dir_name);

for ($i = 0; $i 0) { //check if any file uploaded

for($j=0; $j $dir_name[$i],
‘mobileno’ => $dir_mobile[$i],
‘blood’ => $dir_blood[$i],
‘designation’ => $dir_designation[$i],

‘photo’ => $dir_photo['name'][$i]
);

$this->db->insert(‘directors’, $post_dir); //(director is table name)

}
redirect(‘secure/member’);
}
else
{
print “Error Insert”;
}
}
}

}

?>

Leave a Reply 165 views, 3 so far today |

Most Commented Posts

Follow Discussion

One Response to “Multiple File Upload In Codeigniter And Php”

  1. Cerita Lucu Says:

    I like the valuable info you supply for your articles. I will bookmark your weblog and check again here frequently. I’m quite sure I’ll be informed plenty of new stuff right here! Good luck for the following!

Leave a Reply

CAPTCHA Image
Refresh Image
*