sendfile is the general function representation of sending data/file over the network. The network may be raw tcp sockets or any other connection itself. This tag should be used for querying about such file sending methods defined in different web/(android etc.) frameworks
Questions tagged [sendfile]
279 questions
9
votes
2 answers
Django and Nginx X-accel-redirect
I have been fumbling around with trying to protect Django's media files with no luck so far! I am simply trying to make it where ONLY admin users can access the media folder. Here is my Nginx file.
server {
listen 80;
server_name…

Tyler Bell
- 837
- 10
- 30
7
votes
4 answers
Cannot read file with send_file function in Rails 3
The code I am using:
In view file:
<%= link_to "Download", download_image_path(image) %>
In controller:
def download
@image = Image.find(params[:id])
send_file "#{RAILS_ROOT}/public" + @image.attachment.url
end
I am getting an error:
Cannot…

Mohit Jain
- 43,139
- 57
- 169
- 274
7
votes
2 answers
Why does Apache recommend against using sendfile() with NFS on Linux
The Apache documentation includes this statement for EnableSendfile:
With a network-mounted DocumentRoot (e.g., NFS, SMB, CIFS, FUSE), the kernel may be unable to serve the network file through its own cache.[1]
The default configuration for…

protospark
- 71
- 1
- 2
6
votes
1 answer
RSpec send_file testing with check of Content-Type
I have a Rails Controller that send a file with different Content-Type
Example for Exel-File, the controller set Content-Type = "application/excel"
and here is the RSpec test:
describe "GET getfile" do
it "Excel File" do
…

romus
- 63
- 1
- 4
6
votes
1 answer
Ruby/Sinatra send_file not working
I'm using send_file on a Sinatra app:
get '/update/dl/:upd' do
filename ="/uploads/#{params[:upd]}"
send_file(filename, :filename => "t.cer", :type => "application/octet-stream")
end
The folder /uploads/ it's not public, it's on the app…

pmerino
- 5,900
- 11
- 57
- 76
6
votes
0 answers
Angular + Node + Express : Unexpected token with sendFile method
I am kinda stuck here. I am coding a webapp with Angular 4 on the client side and a REST API with Node/Express/Mongo on the server side, with an authentification with Auth0 API.
On the server side, I serve static files and all routes to Angular…

Fabrice Demarthon
- 61
- 3
6
votes
1 answer
sendfile64 only copy about 2GB
I need to use sendfile64 to copy about 16GB of files. What I have achieved so far is
#include
#include
#include
#include
#include
#include
#include
#include…

Ste
- 271
- 1
- 2
- 13
6
votes
2 answers
sendfile doesn't copy file contents
I create files 1.txt 2.txt and write some content into 1.txt.
Then I use the code below and want to copy the content to 2.txt.
But it doesn't work. There is nothing in 2.txt.
Can you explain my mistake?
int main()
{
int fd1 =…

Tengchao
- 157
- 1
- 3
- 7
5
votes
2 answers
How to send pdf file back to user using python telegram bot?
I tried to use update.sendDocument(chat_id = update.message.chat_id, document = open(something.pdf, 'b')) but it did not return me a pdf file. Any help?

codingsospls
- 51
- 1
- 1
- 2
5
votes
3 answers
Rails 3 - how to send_file in response of a remote form in rails?
I have this coupon form
<%form_for(:download,:download,:url=>{:controller=>"coupons",:action=>"verifycoupon"},:remote=>true) do |f| %>
<%=text_field :download,:code%>
<%=f.submit "verify"%>
<%end%>
and after validating the code on…

Mr_Nizzle
- 6,644
- 12
- 55
- 85
5
votes
2 answers
SSL website in rails forwards me to a url with port 443 suffix
First off, this is my first SSL web application so I might be doing something horribly wrong.
We turned on SSL per request from a client on https://bla.be/
It seemed to work out of the box. We ordered web hosting with SSL and we didn't seem to have…

Steven De Coeyer
- 185
- 1
- 7
4
votes
4 answers
Wicked_PDF Download Only - Rails 3.1
I currently run Rails 3.1 and am using the latest version of Wicked_pdf for PDF generation.
I have set everything up correctly, and PDFs are generated just fine.
However, I want the user to be able to click a button to DOWNLOAD the pdf. At the…

Ammar
- 1,091
- 12
- 23
4
votes
1 answer
Is there a way to make an SFTP connection to a remote machine through jump server to transfer files?
I was wondering if there's a way to send files using SFTP to a remote machine through a jump server.
As you can see in the image below first it's needed an SSH connection and after that an SFTP connection.
My main problem here comes after the SSH…

Felipe
- 174
- 5
- 16
4
votes
1 answer
How do you catch `Error: ENOENT: no such file or directory` with winston?
I am using express with winston logger. I am seeing an error Error: ENOENT: no such file or directory when express tries to serve a file for which the path is not accurate. This is the expected behavior. However, the error does not get logged…

billbitt
- 151
- 12
4
votes
1 answer
Unable to Download file using flask with actual name
I am trying to download the file using flask. my code is as follows
@app.route('/Download')
def Down():
rpm = request.args.get('rpm')
root = '/home/rpmbuild/RPMS/'
return send_from_directory(root,rpm)
The name of the file is passed in…

Usama
- 480
- 4
- 15