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);

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");

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

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

| improve this answer | |

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.