To get the full path of an attachment use the following method.
If you just want the filename and not path then use the following code.
<?php $path = get_attached_file( $attachment_id ); ?>
The above will give you full path of the file/attachment.If you just want the filename and not path then use the following code.
<?php $filename_only = basename( get_attached_file( $attachment_id ) ); ?>
This will give you just the filename.
No comments:
Post a Comment