jeudi 5 novembre 2015

CakePHP File API not working

I'm trying to open a file using CakePHP's File API, but it is not working. When I put in the file path is throws a warning saying that it expects a string, which I am passing. Here is my code:

//more code before this...
}elseif(is_uploaded_file( $file_tmp_name)){
    $filePath = $dir.DS.$filename;    // I store the file path
    $this->insertToDB($filePath);      //I pass the path as a parameter

public function insertToDB($path){      //lee el archivo recien subido para agregarlo a la BD
    $query = $this->connect();      //conectar a base de datos
    echo $path;
    echo gettype($path);
    $file = new File($path);

When I try to run it, it throws an error saying that $path is an array, and taht it expects a string. I have already printed $path and its type and everything seems to be in order. Any ideas? Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire