Create Accessible Attachment Links
You can use the WordPress wp_get_attachment_link and get_attached_file functions in a number of ways to generate accessible download links — including outputting the file size and type.
The wp_get_attachment_link function has 4 parameters:
- the post ID
- the associated image size (‘thumbnail’ or ‘medium’)
- option to display the attachment’s permalink (boolean — ‘false’ or ‘true’)
- option to display an associated image icon (boolean — ‘false’ or ‘true’)
<?php
// create a text link to an attachment
$text_link = wp_get_attachment_link($post->ID,'',true,false);
// create a link to an attachment using an icon
$icon_link = wp_get_attachment_link($post->ID,'thumbnail',false,true);
// get an attachment filesize in kilobytes
$filesize = ceil(filesize(get_attached_file($post->ID))/1024).'K';
// grab an attachment extension
$bits = explode('.',get_attached_file($post->ID));
$ext = '.'.$bits[count($bits)-1].' format';
// put it all together
echo $icon_link. ' '.$text_link.' <small>('.$ext.' '.$filesize.')</small>';
?>

Sun City 4.0
eShop.po
I want to attach a document from my PC and i want that file to make it as a link, so that whenever i click on that link, i should open that particular attachmemnt…how to upload that attachment to make it as a link?/
Upload the file via the WordPress Add Media interface. Look for the starburst icon just above the post content entry area when adding/editing a post. From then on, it’s exactly like adding an image to a post.