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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:54:25+00:00 2026-05-17T15:54:25+00:00

Can I use send_file to send a file on a drive other than the

  • 0

Can I use send_file to send a file on a drive other than the Rails.root drive? I’ve tried both options below. I need to use the second option but Rails doesn’t like using a drive other than the volume on which it is on.

This works:

def action
  send_file "C:\\rails_root\\public\\files\\file.ext"
end

This doesn’t:

def action
  send_file "D:\\files\\file.ext"
end

Is send_file restricted to just the Rails.root drive? Is it possible to serve static files from a directory on a network mapped drive? Oh, and this is (un)fortunately an all windows environment.

UPDATE: So I’ve been digging around in the Rails/Ruby code that send_file uses and I think the primary culprit here is File.file?(path). It returns true when on the drive which Rails lives but false for networked drives.

UPDATE 2: Really strange. In the console both locations inserted for File.file?(path) return true. In the application running in the browser it returns false. I’m stumped.

  • 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-17T15:54:26+00:00Added an answer on May 17, 2026 at 3:54 pm

    It turns out that the service running Apache didn’t have permissions to access the network share.

    In the controller I ended up using the direct network share address instead of using the mapped drive. I’m still not sure why the mapped drive didn’t work.

    def download
       send_file "\\\\server\\folder\file.ext"
    end
    

    In the Apache configuration file (domain.conf) you have to use forward slashes when setting the parameters for XSendFile.

    XSendFile on
    XSendFilePath //server/folder/
    

    If anyone else has issues I’ll be glad to try and help.

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

Sidebar

Related Questions

I have a website on which visitors can use a send to a friend
In ASP.net MVC 2, I can use routes.RouteExistingFiles = true; to send all requests
I'm trying to send an ActionSheet a variable from a button. I can't use
I'd like to use JMeter test that I can send a message to a
Currently I'm using the following function file.Delete(); But how can I use this function
I want to send a file from serial port and I have to use
I want to know the way by which I can send a SharedPreference file
I've to send a file to my server using jQuery. How can I do
I have a C/S program. Client use socket to send a file to server,
I need to send a file to a external web service. When the response

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.