Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Making image files downloadable for Nokia Asha Web Apps

From Wiki
Jump to: navigation, search

This article explains how to make image files downloadable for Nokia Asha Web Apps 2.0 Beta

Article Metadata
Tested with
Devices(s): Nokia X3-02
Platform(s): Nokia Series 40 devices
Device(s): All supporting Nokia Browser 2.0
Created: isalento (25 Jun 2012)
Last edited: hamishwillee (09 May 2013)


Series 40 web apps 2.0 Beta brings support for downloading files. However image files located in remote server do not trigger downloading process unless server is configured to do so. This article describes how image files can be made downloadable in Apache server environment.

Making image files downloadable

The magic word, which enables Nokia Browser to download images, instead of just showing them, is Content-Disposition header ( Downloading is forced by setting Content-Disposition to attachment and specifying filename. Specified file name is presented to the user in browser’s download dialog. One common way is to use PHP to write content disposition header.

header('Content-type: image/jpeg');
header('Content-Disposition: attachment; filename="image.jpg"');

Another way to achieve the same functionality is to use Apache’s mod_headers module. Mod_headers directive provides convenient way to add headers to all of the files with certain extension. Even better, mod_headers directives can be added to .htaccess file. Following code adds Content-Disposition header to all of the *.jpg image files in current directory. Thus now when trying to access any image file in that directory, browser downloads it instead of just showing it.

<FilesMatch "\.(jpg)$">
ForceType image/jpeg
Header set Content-Disposition attachment
This page was last modified on 9 May 2013, at 10:36.
42 page views in the last 30 days.