Title: Disabling filename sanitizing
Last modified: August 18, 2016

---

# Disabling filename sanitizing

 *  [demonbane](https://wordpress.org/support/users/demonbane/)
 * (@demonbane)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/disabling-filename-sanitizing/)
 * I’ve been struggling with this for about 5 hours now to no avail. No matter what
   I do, whenever I upload a file the filename gets sanitized for me. In particular
   all periods except for the last one get removed. This breaks files with two-part
   extensions. (e.g. ‘.tar.gz’)
 * Looking through the code, I found 3 possible suspects:
 * sanitize_file_name in formatting.php
    I’ve tried just removing the period replacement
   code, as well as commenting out the entire function only leaving ‘return $name’,
   to no avail.
 * mw_newMediaObject in xmlrpc.php
    I’ve tried taking out the sanitize_file_name
   call altogether, with no luck.
 * clean_url in formatting.php
    On a whim, I also tried removing the period from
   the first preg_replace line in clean_url, with no luck. (This actually caused
   some strange behavior during uploads.)
 * So how can I prevent WP from removing periods from my uploads?!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [letssurf](https://wordpress.org/support/users/letssurf/)
 * (@letssurf)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/disabling-filename-sanitizing/#post-599076)
 * any luck with this? I have the same problem.
 *  751056
 * [17 years, 11 months ago](https://wordpress.org/support/topic/disabling-filename-sanitizing/#post-599140)
 * Yes, here is a solution:
    The name of uploaded files gets sanitized by `wp_unique_filename()`
   in `wp-includes/functions.php`. To fix your problem, on line 1154 of `functions.
   php`, change `sanitize_title_with_dashes` to `sanitize_file_name`. I believe 
   this is a bug in WordPress, as they are using a title sanitize on a filename.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Disabling filename sanitizing’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 2 replies
 * 3 participants
 * Last reply from: 751056
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/disabling-filename-sanitizing/#post-599140)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
