uploading two files, need to set different file type for each - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: uploading two files, need to set different file type for each (/showthread.php?tid=54456) |
uploading two files, need to set different file type for each - El Forum - 09-09-2012 [eluser]Brad K Morse[/eluser] I have two fields: image, document I want to set allowed_types for each field, so image only accepts: jpg|png and document accepts: doc|xls|pdf I know how to upload both those files from those fields, but I am unsure on how I would set each allowed_types, max_size, etc... I checked the documentation, but it was not clear. I assume I will need to create two different config arrays, example: $config_image[], $config_document[] Then set it like this: $this->load->library('upload', $config_image) and $this->load->library('upload', $config_document) Then set the appropriate field in $this->upload->do_upload("image") So in theory: Code: $image = $this->input->post("image"); I have not tried this, I wanted to see what you thought first, thanks. uploading two files, need to set different file type for each - El Forum - 09-09-2012 [eluser]Aken[/eluser] Load the library without a config, then use initialize() before each upload, and a clear() after the first one. Code: $this->load->library('upload'); |