I have a mysql table, students. One of the fields is a blob field that contains a PDF of their resume.
Will gridphp be able to show the resume field in the table? I deally, I want the user to click on a record and have the pdf open.
Just to be clear, I do not want to upload files via gridphp. The pdf files are already in the MySQL db and I want to display them in a grid. Show as a link and have them open it.
Hello,
Apologies for the late reply.
Yes, both things are doable.
You can display link that will open / download blob,
and upload blob in database as well.
Sample code:
https://gridphp.com/demo/demos/editing/file-upload-blob.phps
I get next error
Couldn’t execute query. Column ‘fcontents’ cannot be null – insert into filecontents (fname,fcontents) values (‘Captura de pantalla 2024-11-02 091649.png’, LOAD_FILE(‘/home4/trackexm/public_html/sistema/intranet/temp/Captura de pantalla 2024-11-02 091649.png’))
What is wrong ?
Apparently the parameter $p does not have the value
// insert in db as blob
$g = new jqgrid();
$g->execute_query(“insert into filecontents (fname,fcontents) values (‘{$data[“params”][“fname”]}’, LOAD_FILE(‘{$p}’))”);
Looks like the LOADFILE function is returning null. Here are the possible reasons.
https://stackoverflow.com/a/24459279/385377
Test it in phpmyadmin first before using in code if the following query works.
insert into filecontents (fname,fcontents) values (‘Captura de pantalla 2024-11-02 091649.png’, LOAD_FILE(‘/home4/trackexm/public_html/sistema/intranet/temp/Captura de pantalla 2024-11-02 091649.png’))