Problem inserting file name into database

1

I'm uploading files with plupload using codeigniter. My problem is when there are special characters in the file name. Being that I have to record this original name.

When there is for example: 'copy' is saved in the database: 'copy'

Everywhere in the application I declare that I am using utf-8

Any suggestions?

    
asked by anonymous 10.02.2015 / 13:10

1 answer

-1

Try to rewrite the variable or function that takes the file name using this form of rewrite

<?
/*
* Script para remover acentos e caracteres especiais:
*/

$palavra = "açúcar união";

$palavra = ereg_replace("[^a-zA-Z0-9_]", "", strtr($palavra, "áàãâéêíóôõúüçÁÀÃÂÉÊÍÓÔÕÚÜÇ ", "aaaaeeiooouucAAAAEEIOOOUUC_"));

echo($palavra);   // imprime "acucar_uniao"

/*
* A função "strtr" substitui os caracteres acentuados pelos não acentuados.
* A função "ereg_replace" utiliza uma expressão regular que remove todos os caracteres que não são letras, números e são diferentes de "_" (underscore).
*/
?>
    
27.02.2015 / 19:55