upload question - 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: upload question (/showthread.php?tid=36730) |
upload question - El Forum - 12-13-2010 [eluser]kris10[/eluser] Hello Writing an application with music file, I write the upload code But what I would like to to is rename the file by the id of the record but keep the extension. I already rename by 1.mp3 or id but I can I have other extension I don't know how to check the extension it could be mp3 ogg or wma ... Quote:$config['file_name'] = $_POST['id'].".mp3"; how to replace ".mp3" but the right code in order to keep the orgininal ext of the file and just rename the name of the file upload question - El Forum - 12-13-2010 [eluser]Twisted1919[/eluser] Ain't gonna work like this . First, you need to upload the file as it is, then, you get the properties of the uploaded file like $props = $this->upload->data(); now, $props is an array, containing: Code: Array Knowing that, you can use rename() to move rename your file to other name, but keep the extension . |