Insert Causing A Break And Clears Sessions

QuestionsInsert Causing A Break And Clears Sessions
Bruce Rick asked 2 years ago

I’ve been working on this for a few days now and I’m stuck on this part. Every time a file is uploaded to the system, it completes the insert into the database, the file gets uploaded, but then an error is thrown in my system and the user gets logged out. I followed the example from file upload and everything looks correct, but something is not working properly:

function add_insert($data)
{
global $g;

try
{
$upload_file_path = $data[“params”][“fileupload”];
unset($data[“params”][“fileupload”]);

// if file is uploaded
if ($upload_file_path)
{
$data[“params”][“fname”] = pathinfo(realpath($upload_file_path), PATHINFO_BASENAME);

$file_content = file_get_contents(realpath($upload_file_path), true);

// check if file ext allowed
$ext = pathinfo(realpath($upload_file_path), PATHINFO_EXTENSION);
if ($ext <> “gif” && $ext <> “jpg” && $ext <> “png” && $ext <> “webp”)
{
unlink(realpath($upload_file_path));
phpgrid_error(“Only pdf, gif, jpg, txt, doc, bmp, png files are allowed!”);
}

// insert in db
// $g = new jqgrid();
$g->execute_query(“insert into oems (oemname, oemimagename, oemenabled) values (‘{$data[“params”][“oemname”]}’, ‘{$data[“params”][“fname”]}’, 1)”);
}
}
catch (Exception $ex)
{
}
}

 

View post on imgur.com

1 Answers
Abu Ghufran Staff answered 2 years ago

Possibly duplicate.

Answered here: https://www.gridphp.com/support/questions/on_insert-with-image-problem/#answer-12098

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

19 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?