Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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 8 years, 5 months ago by harisdozz.
    • This reply was modified 8 years, 5 months ago by harisdozz.
    Forum: Reviews
    In reply to: [WP-Polls] Not Working..

    Works well to me on WordPress 3.5.

    Show me the code which you are using to display it.

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