CodeIgniter Forums
How to get file name? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How to get file name? (/showthread.php?tid=30800)



How to get file name? - El Forum - 05-26-2010

[eluser]Unknown[/eluser]
I follow user guide at http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html to create my upload file application.

But I have a problem when I try to get the original file name.

Code:
.......
.......
.......
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size']    = '100';
$config['file_name']    = time().'_original_name'; // I tried = time().'_'.$_POST['userfile']; but it doesn't work
$config['max_width']  = '1024';
$config['max_height']  = '768';
......
......
......

Thanks for help


How to get file name? - El Forum - 05-26-2010

[eluser]danmontgomery[/eluser]
You use $_FILES to access uploaded files, not $_POST

http://php.net/manual/en/reserved.variables.files.php


How to get file name? - El Forum - 05-26-2010

[eluser]Unknown[/eluser]
:red: Achh.. Thanks noctrum


How to get file name? - El Forum - 05-26-2010

[eluser]vitoco[/eluser]
also...you can't concatenate $_FILES['userfile'] to a string , cause $_FILES['userfile'] it's an array, get the appropriated index inside the array.