Jump to content

ImportEverything! (Cannot read/open CSV file from field in page under admin)


Recommended Posts

Pressing problem at initial posting:  I am working on a module that runs/previews (for pub/unpub) imports on importer page view. The template has to be in site/templates, so far as I know, so one is created there on install which includes a file to run from within the module, but then when it's run and tries to read the importer csv file it cannot, since it's in the admin, I guess... Is it possible to set the template page to a file in the module directory? Will that work?


Edited by hellomoto
reference module in question
  • Like 1
Link to comment
Share on other sites

I have this happening in the template file:

    if(file_exists($filepath)) echo $filepath;
    echo "<a href='$filepath'>csv</a>";
    $file = fopen($filepath, 'r');
    print_r(fgetcsv($file, 0, ',', '"'));

where $filepath = $this->source->url (in a class method). So it's the page's attached CSV file's URL. The link works and downloads the file, which supposedly doesn't exist, according to the preceding line. Why??

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...