I have written a custom module in which i have a download button like given below.
$form['topics_info_graph']['download_graph'] = array(
'#type' => 'button',
'#value' => t('Download Graph'),
'#button_type' => 'button',
'#ajax' => array(
'callback' => 'digitaliq_bckgrd_variable_ajax_download_callback',
'wrapper' => 'download_graph',
'event' => 'click',
),
);
Onclick of this button i need to download a jpg image which is located in the temp folder. I'm able identify the file name and the path, Not sure how to download. any help?
function digitaliq_bcgrd_variable_file_download($filename) {
$temporary_directory = variable_get('file_public_path', conf_path().'/files').'/tmp';
$temp_path = $temporary_directory . '/';
// Download logic should come here, any help?
}