I'm using this code to list the image attachments of a post:
<select name="chb_homes_for_sale_specifics_floor_plan" style="width:100%;">
<option value="">Select</option>
<?php
$args = array(
'numberposts' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image'
);
$image = get_posts($args);
if($image) {
foreach($image as $key => $data) : ?>
<option value="<?php echo $data->ID; ?>"><?php echo $data->post_title; ?></option>
<?php endforeach;
}
?>
</select>
But what I'm showing currently is the attachment post_title
but I want to show the file name instead. I could maybe use get attachment URL then parse the URL to get the file name but was wondering if there is a ready made way in WordPress to get the file name.