• Hello and thank you for reading this.

    I have a .csv file that I am trying to read in a static page. Although the file was uploaded correctly and I have no restriction reading .csv on the server (just checked the same script outside WordPress and works fine), when I read it in WordPress i got this errors:

    Warning: fopen() [function.fopen]: Unable to access file.csv in /hosting/web/clients/domain.tld/blog/wp-content/themes/theme_name/csvreader.php on line 46

    Warning: fopen(clasament.csv) [function.fopen]: failed to open stream: No such file or directory in /hosting/web/clients/domaind.tld/blog/wp-content/themes/theme_name/csvreader.php on line 46

    where domain.tld is my domain name and theme_name is the theme I’m using.

    This is the code I’m using:

    $handle = fopen(“file.csv”, “r”);
    while(($data = fgetcsv($handle, 1000, “,”)) !== FALSE) {
    $num = count($data);
    for ($c=0; $c < $num; $c++) {
    if ($data[$c]!=”){
    echo $data[$c];
    }
    }
    $row++;
    }
    fclose($handle);
    ?>

    Any idea why I could have this problem? 10x.

  • The topic ‘problem reading a .csv’ is closed to new replies.