作者: takayo72 時間: 2017-1-19 18:38 標題: 有無師兄熟codeigniter ? 有關file upload
提示: 作者被禁止或刪除 內容自動屏蔽
作者: 型氣小子 時間: 2017-1-19 21:50
本帖最後由 型氣小子 於 2017-1-19 21:52 編輯
- <form method="post" action="submit" enctype="multipart/form-data">
- <input type="file" id="itemPictures" name="itemPictures[]" multiple>
- </form>
- $files = $_FILES;
- $file_count = count($_FILES['itemPictures']['name']);
- for($i = 0; $i < $file_count; $i++) {
- $_FILES['itemPictures']['name'] = $files['itemPictures']['name'][$i];
- $_FILES['itemPictures']['type'] = $files['itemPictures']['type'][$i];
- $_FILES['itemPictures']['tmp_name'] = $files['itemPictures']['tmp_name'][$i];
- $_FILES['itemPictures']['error'] = $files['itemPictures']['error'][$i];
- $_FILES['itemPictures']['size'] = $files['itemPictures']['size'][$i];
- $config['upload_path'] = './upload';
- $config['allowed_types'] = 'gif|jpg|png|jpeg';
- $config['max_size'] = '5000';
- $config['max_width'] = '5000';
- $config['max_height'] = '5000';
- $config['max_filename'] = 0;
- $config['overwrite'] = false;
- $config['remove_spaces'] = true;
- $config['encrypt_name'] = false;
- $config['file_name'] = 'file' . $i;
- $this->upload->initialize($config);
- if( ! $this->upload->do_upload('itemPictures')) {
- break; //skip and process next photo
- } else {
- $upload = $this->upload->data();
- }
- }
作者: 型氣小子 時間: 2017-1-19 21:53
hope this can help u
作者: takayo72 時間: 2017-1-20 06:12
提示: 作者被禁止或刪除 內容自動屏蔽
作者: takayo72 時間: 2017-1-20 13:19
提示: 作者被禁止或刪除 內容自動屏蔽
作者: 7h1r733n 時間: 2017-1-20 13:50
再問一下CI嘅嘢,
那個 $this->db->update_batch() 係點樣用㗎?唔太明佢個例子,第三個parameter ,wh ...
takayo72 發表於 2017-1-20 13:19
where係指第二個param入面邊個key做where key
作者: 7h1r733n 時間: 2017-1-20 13:57
- $data = array(
- array(
- 'id'=>1,
- 'name' => 'Mixed paper' ,
- 'type' => 'paper' ,
- 'listorder' => '1'
- ),
- array(
- 'id'=>2,
- 'name' => 'mixed plastic' ,
- 'type' => 'plastic' ,
- 'listorder' => '2'
- ),
- array(
- 'id'=>3,
- 'name' => 'Aluminium' ,
- 'type' => 'aluminium' ,
- 'listorder' => '3'
- ),
- array(
- 'id'=>4,
- 'name' => 'Glass' ,
- 'type' => 'glass' ,
- 'listorder' => '4'
- )
- );
- $this->db->update_batch($table,$data, 'id');
作者: takayo72 時間: 2017-1-20 15:10
提示: 作者被禁止或刪除 內容自動屏蔽
作者: 型氣小子 時間: 2017-1-20 21:55
其實 CI 係幾好用, 多 d 討論大家都會有進步
作者: takayo72 時間: 2017-1-21 11:17
提示: 作者被禁止或刪除 內容自動屏蔽

