php - get the size of a file stored on my database -


i need size of pdf file stored in database

i try

$sid = 1; $getfile = $db->prepare("select * pwork id=?"); $getfile->bind_param('i', $sid); if ($getfile->execute()) {     $fileres = $getfile->get_result();     if ($f = $fileres->fetch_object()) {         $filename = $f->work_file;         $filesize = filesize($filename);     } } 

and got error

( ! ) warning: filesize(): stat failed ch03-libre.pdf in xxx on line 57 

my file stored blob , need file size 5mb

if whole file inside blob, can use mysql functions directly calculate how big blob is.

see article: https://www.virendrachandak.com/techtalk/how-to-get-size-of-blob-in-mysql/

and example:

select octet_length(blob_content) test_blob id = 1 

length returned in bytes.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -