Need to download uploaded binary file

I have uploaded a binary .war file which is nothing but a .zip file with Java web application extension. When I hit the URL for this file, I see junk characters in browsers.

URL: http://www.javaquizmaker.com/QuizGenerator.war

Read More

Need a way by which I can make the users download this file.

By the way, I uploaded using FTP and the Add new media feature of WordPress gave me an error about File upload not supported due to security reasons.

Pls. advise.

Related posts

Leave a Reply

1 comment

  1. If your webserver is Apache, you’ll need to tell apache what kind of mime type your file is, so Apache knows how to handle it. You should be able to use the “application/octet-stream” mime type in your .htaccess, in order for Apache to force a download. Learn more here: http://www.htaccess-guide.com/adding-mime-types/ (see the 3rd paragraph, starting with “A Handy Trick”).

    Regarding the media library — by default, wordpress blocks most types of files from being uploaded. To allow more file types, you’ll need to filter the allowed types. Add this to your theme’s functions.php:

    <?php
    function custom_upload_mimes($mime_types) 
    {
        $mime_types['war'] = 'application/octet-stream';
        return $mime_types;
    }
    add_filter('upload_mimes', 'custom_upload_mimes');
    ?>