php file error. silly small problem

works fine on the desktop with xampp but when i upload it to my webhost it doesnt. The file x.csv is in the same dir

$csv_file = "x.csv";

$handle = fopen(($csv_file), "r");

the error i get is-

fopen(x.csv): failed to open stream: No such file or directory in /var/www/html/x/admin/import_one.php on line 12

Where am I going wrong?

Answers


check that you have reading permissions for x.csv also try

$handle = fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . $csv_file, 'r'); 
(maybe your cwd isn't in the same directory)


Linux is case-sensitive, Windows isn't.

Make sure that your file is called x.csv and not X.csv or x.CSV.


When in doubt use absolute file path.

$path = '/path/dir/something/';
$file = 'x.csv';

$fp = fopen($path . $file, 'r');
if ($fp)
{ 
    // do some amazing stuff here.
}

Need Your Help

map owl to neo4j (java example)

java neo4j owl owl-api

I want to map ontology from OWL into Neo4j database. I have found some example here.