WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

share|improve this question
up vote 5 down vote accepted

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:

function custom_upload_mimes($mime_types) 
    $mime_types['war'] = 'application/octet-stream';
    return $mime_types;
add_filter('upload_mimes', 'custom_upload_mimes');
share|improve this answer
You are a life saver – Sandeep Jun 20 '12 at 4:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.