Title: Plugin has stopped working
Last modified: August 22, 2016

---

# Plugin has stopped working

 *  [drvs](https://wordpress.org/support/users/drvs/)
 * (@drvs)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/plugin-has-stopped-working-7/)
 * Actually I’m using WP 3.8.4. This plugin has been a lifesaver for me for years,
   but it’s stopped working. Any ideas what’s going on?
 * [https://wordpress.org/plugins/overwrite-uploads/](https://wordpress.org/plugins/overwrite-uploads/)

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

 *  Plugin Author [Ian Dunn](https://wordpress.org/support/users/iandunn/)
 * (@iandunn)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/plugin-has-stopped-working-7/#post-5377116)
 * The first thing to try would be to temporarily disable all other plugins, and
   switch to one of the Core themes (like TwentyTwelve), then test if it works.
 * If it does work, then re-activate the plugins one by one and re-test until you
   find the one that causes it to stop working.
 * Keep in mind that the plugin won’t try to overwrite files with the same name 
   if they’re in different directories. See the FAQ for details.
 *  [ascottmccauley](https://wordpress.org/support/users/ascottmccauley/)
 * (@ascottmccauley)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/plugin-has-stopped-working-7/#post-5377439)
 * I’m also having some issues with this plugin, and I think I’ve narrowed it down
   to a very strange issue with the `file_exists()` function.
 * For me, any filename that has a space in it will not be overwritten, but instead
   duplicated, because the `file_exists()`line is returning `false`.
    I’ve tried
   replacing the `$file['name']` with `str_replace(' ', '\\ ', $file['name']` with
   no luck.
 * I have found many reports about this function being buggy, and the only “answer”
   seems to be “fix the file permissions” (which isn’t the problem for me).
 * Any advice on a workaround would be greatly appreciated.
 *  [ascottmccauley](https://wordpress.org/support/users/ascottmccauley/)
 * (@ascottmccauley)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/plugin-has-stopped-working-7/#post-5377440)
 * I finally realized that WordPress has been replacing spaces with dashes in my
   uploaded filenames, so for me the easy fix was just to use
 *     ```
       $upload_dir = wp_upload_dir();
       	$filename = str_replace(' ', '-', $file['name']);
       	if(file_exists($upload_dir['path'] . '/' . $filename)) {
       		ChromePhp::log('query');
       		$args = array(
       			'numberposts' => 1,
       			'post_type' => 'attachment',
       			'meta_query' => array(
       				array(
       					'key' => '_wp_attached_file',
       					'value' => trim($upload_dir['subdir'] . '/' . $filename, '/')
       				)
       			)
       		);
       		$attachment_file = get_posts($args);
       		if(isset($attachment_file[0]->ID)) {
       			if($file['size'] != filesize(get_attached_file($attachment_file[0]->ID)) ) {
       				wp_delete_attachment( $attachment_file[0]->ID, true );
       			}else {
       				$file = array('error'=>'Image ' . $filename . ' already exists.');
       			}
       		}
       	}
       	return $file;
       ```
   
 * and now everything works great.

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

The topic ‘Plugin has stopped working’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/overwrite-uploads.svg)
 * [Overwrite Uploads](https://wordpress.org/plugins/overwrite-uploads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/overwrite-uploads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/overwrite-uploads/)
 * [Active Topics](https://wordpress.org/support/plugin/overwrite-uploads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/overwrite-uploads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/overwrite-uploads/reviews/)

## Tags

 * [file_exists](https://wordpress.org/support/topic-tag/file_exists/)

 * 3 replies
 * 3 participants
 * Last reply from: [ascottmccauley](https://wordpress.org/support/users/ascottmccauley/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/plugin-has-stopped-working-7/#post-5377440)
 * Status: not resolved