regex - .htaccess rule for getting requested file size -


i wonder if there can such thing. wanna check size of file , htaccess rules based on it. example:

# line checkif {requested_file_size} 50 # mb authname "login title" authtype basic authuserfile /path/to/.htpasswd require valid-user 

it's clear want make files specific file size available users (using authentication)

any idea appreciated.

update #1

should done in htaccess

update #2

there many files , urls posted in blog. can't separate larger files folder , update each post, limitation of file size may change in future.

update #3

it's windows server php & helicon app installed

update #4

some people got confused real issue , didn't clear either.

.htaccess + php file authentication (uses api) , checking file size + downloadable files in same server but our website hosted on different server.

obviously .htaccess cannot check requested file size , act accordingly. can possibly make use of external rewriting program feature of rewritemap

you need define rewritemap apache config first:

rewritemap checkfilesize prg:/home/revo/checkfilesize.php 

then inside .htaccess define rule passing :

rewriterule - ${checkfilesize:%{request_filename}} 

%{request_filename} passed php script on stdin.

then inside /home/revo/checkfilesize.php can put php code check size of file , act accordingly redirect uri shows basic auth dialog.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -