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 6053611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:03:36+00:00 2026-05-23T08:03:36+00:00

I have a sinatra application that sends a file to the user when they

  • 0

I have a sinatra application that sends a file to the user when they click a file, I don’t want to give an extension, but Sinatra or the browser is giving it “test.html”

attachment("test")
response.write("write test data")

how can I give the file name of test to the user without it getting renamed to test.html

  • 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-23T08:03:37+00:00Added an answer on May 23, 2026 at 8:03 am

    It might be something the browser is doing, based on the MIME type being passed to it by Sinatra.

    Extensions are significant on Windows, Mac OS and Linux OSes these days, so that value is helpful for the user and their machine’s OS. Maybe you can improve things by providing a hint about the actual type of content being sent.

    Sinatra’s “MIME Types” documentation says:

    When using send_file or static files you may have mime types Sinatra doesn’t understand. Use mime_type to register them by file extension:

    configure do
      mime_type :foo, 'text/foo'
    end
    

    You can also use it with the content_type helper:

    get '/' do
      content_type :foo
      "foo foo foo"
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small web application that is currently running on Sinatra . It
I have a small Sinatra application that is calling a library I developed named
I'm developing a Sinatra-based application and have seen some apps using an environment.rb file
I have a Sinatra application I've created and I'd like to package it as
I have a Sinatra DataMapper app hitting a sqlite3 database that I am attempting
I have a very simple sinatra site that I'm trying to access via ajax
I have the following rake file to create a static version of my sinatra
I have a Sinatra app that basically takes some input values and then finds
why cannot I use @env['REMOTE_ADDR'] outside a route in Sinatra? I want to have
I have a Sinatra application hosted with Unicorn, and nginx in front of it.

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.