Reading a downloaded file from ftp server is not shoing data after using fgetcsv function

Viewed 631

I am using a cURL request for downloading a CSV file from an FTP server.

I have downloaded my file in my webroot folder (in my given path).

But when I am trying to read the CSV data from the file it isn't showing anything. $leadDir is path of my downloaded file.

if ($fp = fopen($leadDir, "r")) {
    echo $fp;
    echo "come after fopen";
    while ($CSVData = fgetcsv($fp)) {
        echo "</br>";
        echo "come after fgetcsv";
    }
}

It is not going inside the while loop.

I have also checked the file permissions, I have given it 777 permissions.

Where is it going wrong?

4 Answers
Related