Title: warning message
Last modified: August 22, 2016

---

# warning message

 *  [mikebaron](https://wordpress.org/support/users/mikebaron/)
 * (@mikebaron)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/warning-message-65/)
 * I’m getting this warning:
 * Warning: chmod() [function.chmod]: No such file or directory in /home/project/
   public_html/mysitepath/wordpress/wp-content/plugins/enable-media-replace/upload.
   php on line 125
 * Warning: Cannot modify header information – headers already sent by (output started
   at /home/project/public_html/mysitepath/wordpress/wp-content/plugins/enable-media-
   replace/upload.php:125) in /home/project/public_html/mysitepath/wordpress/wp-
   includes/pluggable.php on line 896
 * Any ideas?
 * [https://wordpress.org/plugins/enable-media-replace/](https://wordpress.org/plugins/enable-media-replace/)

Viewing 1 replies (of 1 total)

 *  [Vaughan](https://wordpress.org/support/users/m0nty/)
 * (@m0nty)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/warning-message-65/#post-5467351)
 * Looks like a bug in the code.
 * It’s deleting $current_file and then a few lines later it’s trying to chmod the
   file it deleted.
 * 115 – 125
 *     ```
       emr_delete_current_files($current_file);
   
       		// Massage new filename to adhere to WordPress standards
       		$new_filename= wp_unique_filename( $current_path, $new_filename );
   
       		// Move new file to old location, new name
       		$new_file = $current_path . "/" . $new_filename;
       		move_uploaded_file($_FILES["userfile"]["tmp_name"], $new_file);
   
       		// Chmod new file to original file permissions
       		chmod($current_file, $original_file_perms);
       ```
   
 * I think replacing the following line:
 * `chmod($current_file, $original_file_perms);`
 * replace with
 * `chmod($new_file, $original_file_perms);`
 * Should hopefully fix it.

Viewing 1 replies (of 1 total)

The topic ‘warning message’ is closed to new replies.

 * ![](https://ps.w.org/enable-media-replace/assets/icon-256x256.png?rev=1940728)
 * [Enable Media Replace](https://wordpress.org/plugins/enable-media-replace/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/enable-media-replace/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/enable-media-replace/)
 * [Active Topics](https://wordpress.org/support/plugin/enable-media-replace/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/enable-media-replace/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/enable-media-replace/reviews/)

## Tags

 * [chmod](https://wordpress.org/support/topic-tag/chmod/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [upload.php](https://wordpress.org/support/topic-tag/upload-php/)

 * 1 reply
 * 2 participants
 * Last reply from: [Vaughan](https://wordpress.org/support/users/m0nty/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/warning-message-65/#post-5467351)
 * Status: not resolved