Reputation: 137
This gives a Warning Message: filesize(): stat failed for http://localhost/wft/uploads/4_Sat_Sep_10_2016_16_18_52.pdf
$file_path = base_url().'uploads/4_Sat_Sep_10_2016_16_18_52.pdf';
$size = filesize($file_path);
how to find file size of pdf.
Upvotes: 2
Views: 7728
Reputation: 1545
PHP filesize()
function give the file size.
$path = "uploads/your_file";
$size = filesize($path);
NB: Path should be a relative path.
Upvotes: 0
Reputation: 7617
You could do this without using the URI, instead using the path to the File.
<?php
// CHANGE __DIR__ TO FIT WITH THE PATH TO THE ROOT DIRECTORY HOLDING THE PDF FILE
$file_path = __DIR__ . '/uploads/4_Sat_Sep_10_2016_16_18_52.pdf';
$size = filesize($file_path);
Upvotes: 1