Welcome Guest, Not a member yet? Register   Sign In
Upload files with accents in the file name
#1

[eluser]Ricardo SDL[/eluser]
Hi!
This is my environment:
PHP version: 5.3.3
CodeIgniter Reactor version: 2.0.1
OS: Ubuntu 10.04

Basically I want to keep some resemblance between the names of the files uploaded and the files generated in the webserver. For example:
The user upload the file "é a Summer Glau.jpg" and in the server the file "é_a_Summer_Glau.jpg" is generated. I use the default options of the Upload class like overwrite equals FALSE e remove_spaces equals TRUE.

The problem is that the file name generated is like this:
�_a_Summer_Glau.gif (invalid encoding) => on nautillus
?_a_Summer_Glau.gif => on the command line

I tried something like:
Code:
$config['file_name'] = utf8_decode($_FILES['foto']['name']);

But I'm losing the accents in the name of the file. Any ideas on how to solve this?
#2

[eluser]Nick_MyShuitings[/eluser]
Its a nightmare really... I highly suggest filtering out the accents and leaving the plain letter.... After wasting a lot of time on this problem and not finding a solution that is the route that I went.
#3

[eluser]ramm[/eluser]
[quote author="Nick_MyShuitings" date="1304716119"]Its a nightmare really... I highly suggest filtering out the accents and leaving the plain letter.... After wasting a lot of time on this problem and not finding a solution that is the route that I went.[/quote]


Same here, also i think it looks nicer without accents and spaces.
#4

[eluser]Ricardo SDL[/eluser]
I noticed that when my view holding the upload form and the controller files are utf-8 encoded the file names are created nicely. This project I'm working on has mixed files (thanks to the database that is encoded in iso-8859-1) using iso-8859-1 and utf-8 files.




Theme © iAndrew 2016 - Forum software by © MyBB