我正在尝试使用codeigniter文件上传库上传多个图像,但即使选择了多个文件,它也只上传一个文件。请帮助
public CustomerDialog()
{
InitializeComponent();
nw = new northwindEntities();
}
private void CustomerDialog_Load(object sender, EventArgs e)
{
dgvCustomer.DataSource = nw.Customers;
}
private void btnDelete_Click(object sender, EventArgs e)
{
string strSelectedCustomerID = getSelectedCustomerID();
Customer customer = nw.Customers.Where(a => a.CustomerID == strSelectedCustomerID).First();
nw.Customers.DeleteObject(customer);
nw.SaveChanges();
}
//the new customer is persist on the database, but the dgvCustomer is not update.
private void btnAdd_Click(object sender, EventArgs e)
{
Customer newCustomer = new Customer() {
CustomerID = txtCustomerID.Text,
CompanyName = txtCompanyName.Text,
ContactName = txtContactName.Text
};
nw.Customers.AddObject(newCustomer);
nw.SaveChanges();
dgvCustomer.DataSource = nw.Customers ;
dgvCustomer.Refresh();
}
答案 0 :(得分:0)
这可能有助于p_image
是文件名
if (isset($_FILES['p_image']['name'])) {
// total files //
$count = count($_FILES['p_image']['name']);
// all uploads //
$uploads = $_FILES['p_image'];
for ($i = 0; $i < $count; $i++) {
if ($uploads['error'][$i] == 0) {
move_uploaded_file($uploads['tmp_name'][$i], 'uploads/product_cover/' . $uploads['name'][$i]);
}
}
}
答案 1 :(得分:0)
foreach($_FILES as $key => $userfileObject)
{
if ($this->upload->do_upload($key))
{
$errors = $this->upload->display_errors();
flashMsg($errors);
}
else {
// Code After Files Upload Success GOES HERE
$data['content'] = 'success';
$this->load->view('templates/template', $data);
}`enter code here`
}