WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a problem with WordPress Form Manager plugin that doesn't sanitize the uploaded file filename. So, when a user upload a photo with special characters in the filename, you will not be able to show it up on the front-end, for example.

My question is, how can I sanitize that?

Ps: I already shot the question to the plugin's author.

share|improve this question
up vote 1 down vote accepted

I found a way. Change the lines on wordpress-form-manager plugin direcoty -> types -> file.php (around line 109)


if($fileNameFormat == "%filename%"){
    $newFileName = $pathInfo['filename'];


if($fileNameFormat == "%filename%"){
//Sanitize the filename (See note below)
    $remove_these = array(' ','`','"','\'','\\','/','%');
    $newFileName = str_replace($remove_these, '', $pathInfo['filename']);
//Make the filename unique
    $newFileName = time().'-'.$newFileName;                 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.