Drupal7, Coding

How to change/add custome file icon for uploaded files

In theme’s template.php file, we have to write below code :

function <theme-name>_file_icon($variables) {
global $base_url;
$file = $variables[‘file’];
$icon_directory = drupal_get_path(‘theme’, ‘<theme-name>’) . ‘/<file-icon-folder>’;
$mime = check_plain($file->filemime);
$icon_url = file_icon_path($file, $icon_directory);
$token = drupal_get_token(“file/{$file->fid}/download”);
return l(‘<img alt=”” class=”file-icon” src=”‘.$base_url.’/’.$icon_url . ‘” title=”‘ . $mime . ‘” />’ ,
“file/{$file->fid}/download” ,
array(
‘query’ => array(‘token’ => $token) ,
‘html’ => TRUE
)
);
}