Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9084139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:55:57+00:00 2026-06-16T20:55:57+00:00

I have Drupal website and my users can no longer download files. (docx, xlsx,

  • 0

I have Drupal website and my users can no longer download files. (docx, xlsx, etc). In firefox only, when the user clicks a link to download a file the page displays garbage code.

I read elsewhere the solution is to add the following, but it didn’t work. Instead, the user is prompted with a dummy download for the application type each time the page reloads.

drupal_set_header(‘Content-type: application/octet-stream; charset=utf-8’);

I have a simple module which has a page that spits out the links to the files. In this module I added the above to the hook_init() function.

Screenshot of the garbage code

I’ve never encountered this problem before, and I’m not sure why it started. Any help would of course be greatly appreciated. If I find a solution before someone replies with the answer I’ll post it here for future reference.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:55:58+00:00Added an answer on June 16, 2026 at 8:55 pm

    This happens because MIME types are not set correctly.
    You can either force Drupal to set the content-type header to appropriate MIME type, or set it at the server side.

    I’d recommend you to do it in the .htaccess file in your files folder (sites/default/files by default)

    Just put the below code in the .htaccess file (or you can create a new .htaccess file if it’s not there).

    AddType  application/octet-stream  .doc .xls .pdf
    

    Note that hook_init() gets fired at every normal page request. Never do this in this hook or you will end up facing many problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

on my website i have two types of files that end users can download
I have a Drupal website. When a user logs in to my website with
I have a Drupal website where users are clicking on a link that initiates
I want to have a non-Drupal website create a user account in my Drupal
I have a drupal website where i wonna import user settings with a CSV
I've an issue with files ownerships in unix. I have a drupal website and
I have a Drupal website embedding a Flash game. The registered website users are
I have Drupal 6 website which is using FCK Editor as HTML editor. It
I have created a Drupal website with a new page for registration purposes. I
I have this website iloveforwards.com created using drupal. I would like to have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.