![]() |
Is it a good idea to overwrite Super Global Variables ?? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Is it a good idea to overwrite Super Global Variables ?? (/showthread.php?tid=71703) |
Is it a good idea to overwrite Super Global Variables ?? - oppachoriya - 09-14-2018 In my opinion, we should discourage, happy to understand what best practice should be ? Example, where $_FILES is overwritten as PHP Code: $filesCount = count($_FILES['files']['name']); This is commonly used code to upload multiple files .. If this is bad approach.. please share working code for multiple file upload without modify super globals. RE: Is it a good idea to overwrite Super Global Variables ?? - ignitedcms - 09-15-2018 There must be a lot of github projects with codeigniter and multiple file uploads. Personally, I've never needed a multiple file upload. RE: Is it a good idea to overwrite Super Global Variables ?? - Gurutechnolabs - 10-25-2018 (09-14-2018, 11:18 AM)oppachoriya Wrote: In my opinion, we should discourage, happy to understand what best practice should be ? $upload_dir ='upload/'; if(isset($_FILES["sticker_image"]["name"]) && $_FILES["sticker_image"]["name"]!="") { $config['upload_path'] = $upload_dir; $config['allowed_types'] = 'png'; $file = time().'_'.str_replace(' ','_',$_FILES["sticker_image"]['name']); $insert["sticker_image"] = $file; $config['file_name'] = $file; $this->load->library('upload', $config); $this->upload->initialize($config); $this->upload->do_upload('sticker_image'); } Try this code. RE: Is it a good idea to overwrite Super Global Variables ?? - InsiteFX - 10-25-2018 Here is a tutorial on it that shows how to do it without all that mess. Codeigniter Multiple Files Upload |