In pset8 import file on running the command ./import /pset8/US.txt
the file is not opening.I have tried many methods but the interpreter says the file does not exists, although I can clearly see it (with ls). Here is my code:
require("../includes/config.php");
// check if file exists
if(is_readable($argv[1]))
{
// open the file
$handle = fopen("{$argv[1]}", "r");
// parse the file and insert into table 'places'
while (($location = fgetcsv($handle, 0, "\t")) !== FALSE)
{
CS50::query("INSERT INTO places (country_code, postal_code,place_name,admin_name1,admin_name2,admin_name3,admin_code3,latitude,longitude,accuracy) VALUES(?,?,?,?,?,?,?,?,?,?)", $location[0],$location[1],$location[2],$location[3],$location[4],$location[5],$location[6],$location[7],$location[8],$location[9]);
}
// close the file
fclose($handle);
}
else exit("file doesn't exist");
but it's prompting again and again "file doesn't exist". I have already changed the permissions of US.txt, still its undiscoverable. What can be the reason for such strange behaviour.