dscc90150010 2016-04-12 13:04
浏览 26

仅向上载它们的用户显示媒体文件

I need to display on my website media files. For pictures no problem, but for .mht I use iframe and for docx,xlsx,pdf I use google viewer. The display occurs in a session protected page. The files are in a folder protected with htaccess:

order deny,allow
deny from all
allow from 127.0.0.1

By doing this way the iframe and the google viewer fails to access the files as they aren't authorized.

One solution I was thinking would be to detect user ip and add following rules to the htaccess:

allow from google.com
allow from 'user_ip'

But anyone with a google compute engine account could sneak in.

I could use rewrite engine:

 RewriteEngine On
 RewriteRule ^myfiles/([^/]*)^.pdf$ /index.php?file=$1& [L]
 Options All -Indexes

And check the user session in index.php, but my iframe and the google viewer are added dynamically through Ajax calls...

I could also make a temporary copy of the file to a publicly accessible folder. But anyone could just snif this folder and after a while get the whole collection of the files viewed through this.

Any idea on how to restrict access to these files to the users with a valid session only launching an iframe or a google viewer ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法