增加 WordPress 中的上传大小 [英] Increasing the upload size in WordPress

查看:26
本文介绍了增加 WordPress 中的上传大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在不编辑 php.ini 的情况下增加 wordpress 中的文件上传大小限制所以我尝试使用如下规则将 .htaccess 添加到 wp-content/uploads 目录:

I wanted to increase the file upload size limit in wordpress without editing php.ini So I tried adding .htaccess to the wp-content/uploads directory with rules like these:

php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M

这在 wp-content/uploads 中不起作用,上传最大仍然是 2MB如果我把它放在网站 .htaccess 文件中,这确实有效.

This doesn't work in wp-content/uploads, the upload max is still 2MB This does work if I put this in the websites .htaccess file though.

如果我只是将 htaccess 放在上传目录中,为什么这不起作用?增加整个网站的上传大小是否有风险?

Why won't this work if I just put the htaccess in the uploads directory? Are there any risks in increasing the upload size for the entire site?

推荐答案

.htaccess 将无法工作,除非 wp-content/uploads/ 中存在处理上传的 PHP 脚本代码>(它没有).将其放在该文件夹中不会产生您预期的结果,因为它只会影响位于该文件夹中的脚本.

.htaccess won't work unless the PHP script handling the upload exists at wp-content/uploads/ (which it does not). Placing it in that folder does not have the result you may expect because it only impacts scripts located in that folder.

您可以尝试将 .htaccess 文件放入 /wp-admin/ 中,这将更改管理 PHP 脚本中处理的所有文件的上传设置.

You might try placing .htaccess file into /wp-admin/ which will change upload settings for all files handled inside the admin PHP scripts.

从您的帖子中不清楚用户可能在哪里上传文件...您是否在面向公众的网站中使用上传表单?如果是这样,您可能不想在服务器范围内更新设置.如果没有,我认为进行更改不会有太大风险.

Unclear from your post where else users may be uploading files... are you using upload forms in your public-facing website? If so, you may not want to update the settings server-wide. If not, I see no big risks in making the change.

这篇关于增加 WordPress 中的上传大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆