Problem insert file name in database

Asked

Viewed 212 times

1

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

When there is for example: 'copy' is saved in the bank: 'co? sink'

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

Any suggestion?

  • What is the name of your database?

1 answer

-1

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

<?
/*
* 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).
*/
?>
  • Your answer does not meet what is asked in the question. See that it needs to save the original name, it does not want to remove the accents.

  • Yes I wasn’t noticing! More maybe this thread will help http://answall.com/questions/33029/como-remover-accent-no-upload-comphp

Browser other questions tagged

You are not signed in. Login or sign up in order to post.