[SOLVED] renaming, storing and accessing files: name problem |
I suspect what I am going to write is not related to Codeigniter as such, and perhaps it is possible to Google it, but I lack what to google for So please help me out
In my application I allow users to upload files that are then renamed using user first name and last name in the file name as well as some other data. Any symbol can be used by the user, including utf-8 characters; punctuation marks could also happen... the code to generate the new name for the file is: PHP Code: $first_name = 'Donatąsš'; And then the $new_name variable is stored in a db field and used to rename the file and move it to it's new place. After this, the file I get is this: SC_Donat%C4%85s%C5%A1-Gloden%C4%AFs.pdf and the filename string in the DB field is: SC_Donat%C4%85s%C5%A1-Gloden%C4%AFs.pdf So it is the same. But when I get that file name from db and output it on the page, I get it without the urlencode "formatting" for some reason: SC_Donatąsš-Glodenįs.pdf So, when I click on the link that includes that string, I get a 404 page. (this does not happen if the user name is made of ascii characters). Could someone explain to me, how do I have to recode the string from DB on the page so that I get a working link to the file? Donatas Ha, while I would still like to understand how urlencode gets lost in codeigniter, I have just literraly minutes after posting the question found the answer to filename problems, which a function from url helper, called mb_url_title - https://codeigniter.com/user_guide/helpe...elper.html
==
Donatas G.
Yep, I found that when searched through the CodeIgniter 4 Code.
Please add [SOLVED] to your topic title. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |