how cat get the file extension? |
[eluser]tnathos[/eluser]
hi, how i can get the file extension before upload the file? i need know for put the correct path.. img_principal is the input type file in the view... Code: $config['file_1']['upload_path'] = './uploads/logos/';
[eluser]tnathos[/eluser]
ok problem solved.. if any have the same dude... $nombre = $_FILES['img_principal']['name']; $partes = explode(".", $nombre); $ext = end($partes);
[eluser]mattpointblank[/eluser]
You can't access it before the upload - how would the server know what type of file it was if it wasn't uploaded to it first?! http://ellislab.com/codeigniter/user-gui...ading.html Bottom of that page shows you how to access it after the upload.
[eluser]tnathos[/eluser]
thaks.. but i solved the problem whit the code before init the upload... whit this i can know the file extesion and make variable the config path, for multiple uploas files.. xd Code: $nombre = $_FILES[‘img_principal’][‘name’];
[eluser]WebbHelp[/eluser]
There is a function build in PHP5. Code: $nombre = pathinfo($_FILES['img_principal']['name']); This givs you the file extension, to! |
Welcome Guest, Not a member yet? Register Sign In |