简体   繁体   English

Blueimp文件上传:如何不列出子文件夹中的文件?

[英]Blueimp File Upload : How not to list files in subfolders?

For each user I create a main folder we call User . 我为每个用户创建一个主文件夹,我们称为User In this folder, you've got all files the user has uploaded (and the auto-created subfolder called thumbnails ). 在此文件夹中,您拥有用户已上传的所有文件(以及自动创建的子文件夹,称为thumbnails )。 On the backoffice side, I want to upload quotes and invoices in separates folders we'll call quotes and invoices . 在后台,我想将报价和发票上传到单独的文件夹中,我们将其称为报价发票

Here is the tree : 这是树:

User
 |_ file_01.jpg
 |_ file_02.jpg
 |_ file_03.jpg
 |_ file_04.jpg
 |_ thumbnails
 |   |_ file_01.jpg
 |   |_ file_02.jpg
 |   |_ file_03.jpg
 |   |_ file_04.jpg
 |
 |_ quotes
 |   |_ myquote.pdf
 |
 |_ invoices
     |_ myinvoice.pdf

I want to hide files contained in folders quotes and invoices (that are automatically created by blueimp script) without an .htaccess file, each time I want to list the User folder content through blueimp script. 每次我想通过blueimp脚本列出用户文件夹内容时,我想隐藏文件夹报价发票 (由blueimp脚本自动创建)中包含的文件而没有.htaccess文件。

Is there an option in blueimp which could enable/disable listing of subfolders files for instance ? blueimp中是否有一个选项可以启用/禁用子文件夹文件的列表?

That makes sense ? 那讲得通 ?

You can do this with a single .htaccess file to deny access from just the two directories (quotes and invoices). 您可以使用单个.htaccess文件来执行此操作,以拒绝仅来自两个目录(引号和发票)的访问。

This means 1 .htaccess file in the directory User . 这意味着目录User 1个.htaccess文件。

RewriteRule ^(quotes/|invoices/) - [F,L,NC]
  • F - Using the [F] flag causes the server to return a 403 Forbidden status code to the client. F使用[F]标志使服务器向客户端返回403 Forbidden状态代码。 While the same behavior can be accomplished using the Deny directive, this allows more flexibility in assigning a Forbidden status. 尽管可以使用Deny指令来实现相同的行为,但这在分配禁止状态方面具有更大的灵活性。

  • L - The [L] flag causes mod_rewrite to stop processing the rule set. L [L]标志使mod_rewrite停止处理规则集。 In most contexts, this means that if the rule matches, no further rules will be processed. 在大多数情况下,这意味着如果规则匹配,将不再处理其他规则。

  • NC - Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner NC使用[NC]标志会使RewriteRule以不区分大小写的方式进行匹配

See the Apache documentation: http://httpd.apache.org/docs/2.4/rewrite/flags.html 请参阅Apache文档: http : //httpd.apache.org/docs/2.4/rewrite/flags.html

Footnote: If you want them hidden, then you could have an index.html file in your User directory and return a 403 (?) - or move the directories you want to hide out of the web root. 脚注:如果要隐藏它们,则可以在User目录中包含index.html文件,并返回403 (?)-或将要隐藏的目录移出Web根目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM