CodeIgniter Forums
How to encrypted name of an uploaded file? - 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: How to encrypted name of an uploaded file? (/showthread.php?tid=60495)



How to encrypted name of an uploaded file? - El Forum - 04-08-2014

[eluser]Katsune[/eluser]
Hi,

How can I get the name of the uploaded file once it is encrypted? I use this:
Code:
$config['encrypt_name']=true;


but I cant find the way to get the name.

Before, I use this
Code:
$file_name=gettext($_FILES['userfile']['name']);
but it only get the actual file name before being encrypted.

Anyone?

Thanks,


How to encrypted name of an uploaded file? - El Forum - 04-08-2014

[eluser]InsiteFX[/eluser]
Save the encrypted file name to a static variable or a session variable then you will have it.



How to encrypted name of an uploaded file? - El Forum - 04-08-2014

[eluser]Katsune[/eluser]
Hi,

I got it now,

This code gets all the data config for the file to be uploaded, including the encrypted name:
Code:
$upload_data = $this->upload->data();

now this code bellow here calls specifically the 'file_name' which is the holder of the encrypted name:
Code:
$file_name = $upload_data['file_name'];

I dont know why it was named 'file_name' but I think it's the default because I never initialized this name, and my multipart form uses name="userfile"


Thanks,