Title: Importing Shows Error Screen
Last modified: August 31, 2016

---

# Importing Shows Error Screen

 *  Resolved [brianduffey](https://wordpress.org/support/users/brianduffey/)
 * (@brianduffey)
 * [10 years ago](https://wordpress.org/support/topic/importing-shows-error-screen/)
 * When I click to import from the textarea, I get the following message:
 *     ```
       Warning: file_get_contents(): Filename cannot be empty in .../wp-content/plugins/post-notif/admin/class-post-notif-admin.php on line 602
   
       Warning: Cannot modify header information - headers already sent by (output started at .../wp-content/plugins/post-notif/admin/class-post-notif-admin.php:602) in .../wp-includes/pluggable.php on line 1171
       ```
   
 * The import process does work though as pressing back and then navigating to Staged
   shows the subscribers just added.
 * [https://wordpress.org/plugins/post-notif/](https://wordpress.org/plugins/post-notif/)

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

 *  Plugin Author [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * (@devonostendorf)
 * [10 years ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-7367658)
 * Hi Brian,
 * Thanks for trying out Post Notif – I appreciate it!
 * That is a weird situation you’ve described (and the first I’ve heard of it; thanks
   for reporting it). I was not able to recreate this when testing in several of
   my local environments so I am not sure what to tell you.
 * Hopefully you’re able to proceed with using the plugin, though, since, as you
   mentioned, the subscribers were staged, right?
 * Thanks,
    Devon
 *  Thread Starter [brianduffey](https://wordpress.org/support/users/brianduffey/)
 * (@brianduffey)
 * [10 years ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-7367725)
 * Hi Devon,
 * Thanks for your reply. In full disclosure, I inherited this WP site so it is 
   possible there is some bad config that exists that I haven’t discovered yet. 
   And you are right that it is easy enough to ignore since I won’t be importing
   often. However, a bigger concern is if other things were not working as well 
   as a result of whatever the issue here is.
 * For instance, we publish a new post every single night. I set this up yesterday
   and added my email as a subscriber, however I did not get notified when the post
   was published last night. The email is working as I did get the subscribe confirmation
   and subscription confirmed emails, so I am not sure what to check.
 * I am fine with ignoring the initial error, however do you have any thoughts on
   what to check for the new post email? The site is hosted on dreamhost, and the
   logs folder seems to be empty, so I just now manually configured wp-config to
   log errors somewhere else, so I won’t see errors, if any, until after the post
   is published tonight.
 *  Thread Starter [brianduffey](https://wordpress.org/support/users/brianduffey/)
 * (@brianduffey)
 * [10 years ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-7367786)
 * My bad, I see now that it is a manual process, not an automatic one. I see your
   FAQ comment about the scheduling of this, however it seems to me from my quick
   glance over the plugin code that you could very easily add a filter into the 
   publish post hook, which will call your function with the current post ID.
 * Something perhaps like:
    `add_filter('publish_post', 'send_post_notif_ajax_handler');`
 * …and then just modify the send_post_notif_ajax_handler function to accept post
   ID as a parm, instead of getting it from the AJAX post. In fact, doing this could
   allow you to easily add a setting to control if it is done automatically or not,
   I would think.
 * In any case, it does seem like it is working now, so I can demo it to the site
   owner to see if the manual process is acceptable. Thanks for your help!
 *  Plugin Author [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * (@devonostendorf)
 * [10 years ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-7367803)
 * Hi Brian,
 * You beat me to responding! 🙂 I’m glad you were able to get the notifications
   to fire.
 * Thanks for the sample code; I am currently contemplating adding a few different
   options around when/how notifications get sent, so stay tuned.
 * Thanks,
    Devon
 *  Thread Starter [brianduffey](https://wordpress.org/support/users/brianduffey/)
 * (@brianduffey)
 * [10 years ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-7367824)
 * Sounds great. I am happy to assist with any development, if needed. Let me know
   and thanks for your hard work on a very useful plugin! 🙂
 *  Plugin Author [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * (@devonostendorf)
 * [10 years ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-7367866)
 * Thanks, Brian – I appreciate the offer!
 *  [harisdozz](https://wordpress.org/support/users/harisdozz/)
 * (@harisdozz)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-8178848)
 * Hi Devon,
 * Even I am having the same issue here. It happens when we try to import directly
   from textarea (without selecting a file).
 * While going through the plugin code I came across the following code block, from
   which the error is originated from.
 *     ```
       if ( ( ! empty( $_FILES ) ) && ( isset( $_FILES[ 'btnSubscriberFile' ] ) ) ) {
           $file_contents = trim( file_get_contents( $_FILES['btnSubscriberFile']['tmp_name'] ) );
           if ( ! empty( $file_contents ) ) {
   
               // File IS populated and NOT empty
               $subscriber_arr = explode( $row_delimiter, $file_contents );
           } 
       }
       ```
   
 * The problem with this if statement is that it will always return true, regardless
   of the user selecting a file or not. isset only checks whether the attribute 
   is present.
 * I think it’s better If we check whether the tmp_name is empty or not, instead
   of doing isset($_FILES).
 * I have managed to fix the error by replacing the If statement with the following:
   `
   if ( ( ! empty( $_files ) ) && ( !empty( $_files[ 'btnsubscriberfile' ]['tmp_name']))){`
    -  This reply was modified 9 years, 8 months ago by [harisdozz](https://wordpress.org/support/users/harisdozz/).
    -  This reply was modified 9 years, 8 months ago by [harisdozz](https://wordpress.org/support/users/harisdozz/).
 *  Plugin Author [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * (@devonostendorf)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-8195909)
 * Hi harisdozz,
 * Thanks for trying out Post Notif! I am sorry you ran into the issue you did with
   importing subscribers (admittedly, that area of the plugin has likely not been
   as thoroughly exercised by admins as other parts).
 * I REALLY appreciate you supplying the code you used to fix the error; I will 
   incorporate that into the next release.
 * Thanks much,
    Devon
 *  Plugin Author [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * (@devonostendorf)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-8357121)
 * Hi guys,
 * Thanks for identifying this issue and supplying the code to fix it (harisdozz);
   I’ve included this fix in Post Notif v1.1.0.
 * Thanks,
    Devon

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

The topic ‘Importing Shows Error Screen’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/post-notif_dce1e1.svg)
 * [Post Notif](https://wordpress.org/plugins/post-notif/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-notif/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-notif/)
 * [Active Topics](https://wordpress.org/support/plugin/post-notif/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-notif/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-notif/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/importing-shows-error-screen/#post-8357121)
 * Status: resolved