0

I have a module which reads in csv file and adds records to the database. It is working properly on localhost. I am able to upload the file and read and then display the result. But, on my server, i am able to upload the file but this piece of code fails, while reading the file.

 $file_handle = fopen($file_url, "r");
 while (!feof($file_handle) ) {
 $line_of_text = fgetcsv($file_handle, 1024);
 print_r($line_of_text);
}

I realized that it might be a permission issue so , i checked that folder has got 0777 permission where as i am not able to give recursive permission to files, files have permission of 0664. and i get access denied when i try to give it different permission, i am on ubuntu server. After i checked

 $file_handle = fopen($file_url, "r");
 var_dump($file_handle);

On localhost i got: resource(90, stream), whereas on my server i got bool(false).

  • 1
    Try putting print_r(error_get_last()); (that should print the last error your code generated) after your fopen call, and update your answer with the results. – Jance Jan 19 '16 at 15:57
0

Node Import, and Feeds are two solutions I've used recently to import content. they may work with while you maintion that your module read from csv and store in DB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.