x-sendfile

symfony2 store uploaded file non rootweb

馋奶兔 提交于 2019-11-29 18:13:23
I have problem with uploading files, I'm saving uploaded files in a non public folder (non webroot folder), and then I want to get the webPAth of all uploaded files to use them in a video gallery. $videos = $repository->getVideosThumbs($this->getUser()); and then in my twig {% for video in videos %} <a href ="{{ path('neoctus_videobundle_default_watchvideo', {'id' : video.id, 'salt' : app.user.salt }) }}" > <img id="{{ video.id }}" src="/uploads/images/{{video.imgPath}}" alt="1st image description" height="150" width="150" /> </a> {% endfor %} but I can not access the pictures because the

Django - Understanding X-Sendfile

笑着哭i 提交于 2019-11-28 18:15:16
I've been doing some research regarding file downloads with access control, using Django. My goal is to completely block access to a file, except when accessed by a specific user. I've read that when using Django, X-Sendfile is one of the methods of choice for achieving this (based on other SO questions, etc). My rudimentary understanding of using X-Sendfile with Django is: User requests URI to get a protected file Django app decides which file to return based on URL, and checks user permission, etc. Django app returns an HTTP Response with the 'X-Sendfile' header set to the server's file path

Serving Large Files Through Nginx via Rails 2.3 Using x-sendfile

两盒软妹~` 提交于 2019-11-28 07:01:05
Let's say I have a Rails 2.3.2 application fronted by nginx and served by mongrel in which I need to serve a large static file through Rails (to control access to it). I want the Rails app to delegate the transfer of the file to nginx, to avoid blocking the mongrel instance. The available information seems contradictory and incomplete. This post shows how to do it with Apache, and hints that it can also be done with ngninx - but no examples. This post and this post show how to do it using the a plugin that apparently Rails 2.3 makes uncessary. This post suggests that maybe there isn't support

In Ruby on Rails, After send_file method delete the file from server

徘徊边缘 提交于 2019-11-27 19:20:39
I am using following code for sending the file in Rails. if File.exist?(file_path) send_file(file_path, type: 'text/excel') File.delete(file_path) end In this I am trying to send the file and delete the file from server once it is been send successfully. But I am facing issue is, the delete operation is getting executed while sending is performing and due to that I don't see anything in browser. So is there any way in Rails, once the send_file operation is completed delete the file from server. Any help on this would be highly appreciated. Thanks, Chetan Because you're using send_file , Rails

rails media file stream accept byte range request through send_data or send_file method

£可爱£侵袭症+ 提交于 2019-11-27 04:17:44
I have the following problem. Sounds are hidden from the public folder, cause there are only certain Users who should have access to the sound files. So I made a certain method, which acts like a sound url, but calculates first, whether the current user is allowed to access this file. The file gets sent by the send_data method. The problem is just, that I it works quite slow if it works even... The developer of the jplayer plugin, which I use to play the sound, told me that I should be able to accept byte range requests to make it work properly... How can I do this within a rails controller by

Serving Large Files Through Nginx via Rails 2.3 Using x-sendfile

依然范特西╮ 提交于 2019-11-27 01:40:53
问题 Let's say I have a Rails 2.3.2 application fronted by nginx and served by mongrel in which I need to serve a large static file through Rails (to control access to it). I want the Rails app to delegate the transfer of the file to nginx, to avoid blocking the mongrel instance. The available information seems contradictory and incomplete. This post shows how to do it with Apache, and hints that it can also be done with ngninx - but no examples. This post and this post show how to do it using the

Django - Understanding X-Sendfile

岁酱吖の 提交于 2019-11-27 00:53:23
问题 I've been doing some research regarding file downloads with access control, using Django. My goal is to completely block access to a file, except when accessed by a specific user. I've read that when using Django, X-Sendfile is one of the methods of choice for achieving this (based on other SO questions, etc). My rudimentary understanding of using X-Sendfile with Django is: User requests URI to get a protected file Django app decides which file to return based on URL, and checks user

In Ruby on Rails, After send_file method delete the file from server

主宰稳场 提交于 2019-11-26 19:50:00
问题 I am using following code for sending the file in Rails. if File.exist?(file_path) send_file(file_path, type: 'text/excel') File.delete(file_path) end In this I am trying to send the file and delete the file from server once it is been send successfully. But I am facing issue is, the delete operation is getting executed while sending is performing and due to that I don't see anything in browser. So is there any way in Rails, once the send_file operation is completed delete the file from

Using X-Sendfile with Apache/PHP

笑着哭i 提交于 2019-11-26 16:33:00
I can't seem to find much documentation on X-Sendfile or example code for PHP (there is some rails code). Anyone used it before and would mind giving a quick snippet of code and a brief description? Don Neufeld X-Sendfile is an HTTP header, so you want something like this: header("X-Sendfile: $filename"); Your web server picks it up if correctly configured. Here's some more details: http://www.jasny.net/articles/how-i-php-x-sendfile/ If tweaking the web server configuration is not an option, consider PHP's standard readfile() function . It won't be quite as fast as sendfiling, but it will be

Fastest Way to Serve a File Using PHP

白昼怎懂夜的黑 提交于 2019-11-26 14:50:39
I'm trying to put together a function that receives a file path, identifies what it is, sets the appropriate headers, and serves it just like Apache would. The reason I am doing this is because I need to use PHP to process some information about the request before serving the file. Speed is critical virtual() isn't an option Must work in a shared hosting environment where the user has no control of the web server (Apache/nginx, etc) Here's what I've got so far: File::output($path); <?php class File { static function output($path) { // Check if the file exists if(!File::exists($path)) { header(