[英]Why isn't .htaccess file being edited?
On my website, I have image uploading input field in one of the forms, and in general when I try to upload an image, everything works fine, but in some cases an error occurs in a file processing the form input.在我的网站上,我在 forms 之一中有图像上传输入字段,通常当我尝试上传图像时,一切正常,但在某些情况下,处理表单输入的文件会出错。 When I var_dump $_FILES array, I can observe that all elements of the array except name are empty.当我 var_dump $_FILES 数组时,我可以观察到数组中除 name 之外的所有元素都是空的。
I've noticed that it depends on a file size which is being uploaded.我注意到这取决于正在上传的文件大小。 So I decided to edit .htaccess file to increase maximum possible value of uploaded image.所以我决定编辑 .htaccess 文件以增加上传图像的最大可能值。 .htaccess file is placed in the root directory of my project , I'm using XAMPP. .htaccess文件放在我项目的根目录下,我用的是XAMPP。
I wrote these lines in .htaccess:我在 .htaccess 中写了这些行:
php_value file_uploads = On
php_value post_max_size = 100000M
php_value upload_max_filesize = 100000M
<Directory />
AllowOverride All
</Directory>
But it doesn't seem to work.但这似乎不起作用。 The problem still occurs when I upload a bigger image.当我上传更大的图像时,问题仍然存在。
What am I doing wrong?我究竟做错了什么? How can I make .htaccess work?如何使 .htaccess 工作?
UPD 0: I made some changes to the post UPD 0:我对帖子进行了一些更改
php_value file_uploads = On php_value post_max_size = 100000M php_value upload_max_filesize = 100000M <Directory /> AllowOverride All </Directory>
The <Directory>
container is not valid inside .htaccess
files and nor is it required here. <Directory>
容器在.htaccess
文件中无效,此处也不需要它。 The .htaccess
file itself is effectively the <Directory>
container. .htaccess
文件本身实际上是<Directory>
容器。
Also, the syntax for setting the PHP config vars is incorrect, there should be no =
here.此外,设置 PHP 配置变量的语法不正确,这里应该没有=
。 For example:例如:
php_flag file_uploads On
php_value post_max_size 100000M
php_value upload_max_filesize 100000M
Since file_uploads
is a boolean, you should really use php_flag
, instead of php_value
to set this.由于file_uploads
是 boolean,因此您应该真正使用php_flag
而不是php_value
来设置它。
Also, whether this works at all is dependent on how PHP is installed.此外,这是否有效取决于 PHP 的安装方式。 This is valid only if PHP is installed as an Apache module (ie. mod_php).这仅在 PHP 作为 Apache 模块(即 mod_php)安装时才有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.