0
如何做一個多文件上傳的笨多文件上傳笨
<input type="file" name="pic[]">
<input type="file" name="pic[]">
<input type="file" name="pic[]">
如何上傳呢?使用do_upload功能
如何做一個多文件上傳的笨多文件上傳笨
<input type="file" name="pic[]">
<input type="file" name="pic[]">
<input type="file" name="pic[]">
如何上傳呢?使用do_upload功能
您可以上傳任意數量的文件
$config['upload_path'] = 'upload/Main_category_product/';
$path=$config['upload_path'];
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '1024';
$config['max_width'] = '1920';
$config['max_height'] = '1280';
$this->load->library('upload');
foreach ($_FILES as $key => $value)
{
if (!empty($key['name']))
{
$this->upload->initialize($config);
if (!$this->upload->do_upload($key))
{
$errors = $this->upload->display_errors();
flashMsg($errors);
}
else
{
// Code After Files Upload Success GOES HERE
}
}
}
你可以看到有沒有必要name屬性的。
它不適合我,所以我用代碼從http://stackoverflow.com/questions/9903619/codeigniter-html5-trying-to-upload-multiple-images-at-once這對我很有用。 – 2013-09-09 11:53:18
請參閱http://stackoverflow.com/questions/9845872/codeigniter-uploading-multiple-files-with-one-input/9846065#9846065我幾天前回答。 – Woxxy 2012-03-26 18:52:39
你可以看到這篇文章的stackoverflow希望這可以幫助你http://stackoverflow.com/questions/1908247/codeigniter-multiple-file-upload – Pus 2012-03-26 18:58:48