Hi I have the filename and fid of the uploaded file in a media entity, how can I programatically get the size and last uploaded date in my module? This is with D8 thanks
1 Answer
This is the code to get the size:
$tid=$fileupload[0]['target_id']; $file = File::load($tid); $size = $file->getSize(); - Use like
\Drupal\file\Entity\File::load($tid)or adduse Drupal\file\Entity\Fileat top of the filesiddiq– siddiq2018-04-05 06:23:19 +00:00Commented Apr 5, 2018 at 6:23