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

  • Home
  • SEARCH
  • 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 6336501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:04:08+00:00 2026-05-24T19:04:08+00:00

Is it possible to download a file from my server directly to a user’s

  • 0

Is it possible to download a file from my server directly to a user’s hard drive? when I try to download a CSS file, my browser just opens the css file in a new browser (almost like Microsoft Word would). I want the user to have the actual css file though.

Code

<a href="Stylesheets/custom.css" rel="external">Download This File</a>
  • 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-05-24T19:04:09+00:00Added an answer on May 24, 2026 at 7:04 pm

    If you want to force a download prompt, the simplest way to do it is to use some kind of server-side scripting language to modify the headers so they include Content-Disposition: attachment; filename="file.ext". This is very easy in PHP, but it really depends on what languages/facilities your server has available.

    There are things you can do to the server configuration itself to force this as well – how you do it depends on the server you are running.

    If you wanted to do it in PHP, here is a short example:

    getcss.php (placed in the same directory as the HTML file with the link in it)

    <?php
    
      if (!isset($_GET['file']) || !file_exists($_GET['file'])) {
        header('HTTP/1.1 404 File Not Found');
        exit;
      }
    
      header('Content-Type: text/css');
      header('Content-Length: '.filesize($_GET['file']));
      header('Content-Disposition: attachment; filename="'.basename($_GET['file']).'"');
      readfile($_GET['file']);
      exit;
    
    ?>
    

    Then your link would be:

    <a href="getcss.php?file=Stylesheets/custom.css">Download This File</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am allowing users to download a file from another server just by giving
Is it possible to download a file from a website in Windows Application form
Is it possible to let your user download a file with a different name?
Is it possible to download php files from the server where they are located?
i am using NSURLConnection to download file from server and storing it locally as
When using FileReference.download() to retrieve a file from a server, I'd like to give
I am using the following code to download a file from my server then
I have a simple question Is it possible to download a specific resource file
is it possible to upload a file and subsequently when receiving response download the
Possible Duplicate: Download PDF from url and read it I have to download 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.