Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inport data #5

Closed
erloncharlesbf opened this issue Nov 22, 2013 · 1 comment
Closed

Inport data #5

erloncharlesbf opened this issue Nov 22, 2013 · 1 comment

Comments

@erloncharlesbf
Copy link

I can not use the method "import", it always returns "false"
this is my code:

if($this->request->is('post')){
    $content = file_get_contents($this->request->data["csv"]["tmp_name"]);
    file_put_contents(WWW_ROOT."files".DS."{$this->request->data["csv"]["name"]}", $content);
    $fields = array(
        "Model.colum",
        "Model.colum",
        "Model.colum",
        "Model.colum"
    );
// attempt1     $this->data = $this->Csv->import($this->request->data["csv"]["tmp_name"], $fields);
// attempt2     $this->data = $this->Csv->import($content, $fields);
// attempt3     $this->data = $this->Csv->import(WWW_ROOT."files".DS."{$this->request->data["csv"]["name"]}", $fields);
    debug($this->data);
    echo '<pre>';var_dump($this->data);echo '</pre>';
            
}




@erloncharlesbf
Copy link
Author

The error was caused by the path that the plugin uses to read the file.
I forced the change of path for what I needed and all went well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants