![]() |
File upload - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: File upload (/showthread.php?tid=77750) |
File upload - nfaiz - 10-14-2020 Hi there, I'm using PHP Code: $file->move(WRITEPATH.'uploads', $fileName); It's working but how to overwrite/replace the uploaded file with the same name? Thank you RE: File upload - InsiteFX - 10-14-2020 Here, I just wrote this real quick works but could use some more error checking. Place this in a helper and load it in the BaseController helpers array. PHP Code: /** RE: File upload - nfaiz - 10-15-2020 (10-14-2020, 11:26 PM)InsiteFX Wrote: Here, I just wrote this real quick works but could use some more error checking. Thank you for your help. I greatly appreciate it. Maybe can use it somewhere later. ----- Problem solved. We need to put third parameter to true. But it is not written in our user guide ![]() PHP Code: $file->move(WRITEPATH.'uploads', $fileName, true); |