I am using the file upload demo code on my server and all works great except the delete operation. I get below error while trying to delete a record that is already added to the grid(with image).
code used is https://gist.github.com/anandatheerthan/446e9e59adf8738ea4ec22877dc99f71
The code seems fine and error shows you are using it inside laravel.
In any case, you can create new object inside function and use it to call get_one() function.
function delete_upload($data)
{
$db_conf = array(
“type” => PHPGRID_DBTYPE,
“server” => PHPGRID_DBHOST,
“user” => PHPGRID_DBUSER,
“password” => PHPGRID_DBPASS,
“database” => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);
//phpgrid_error($data[id]);
$rs = $g->get_one(“SELECT image_path FROM mugshots_images WHERE id = {$data[id]}”);
unlink(realpath($rs[“image_path”]));
}
I don’t know exactly. May be it’s due to namespaces used in laravel and limiting scope of $g.