简体   繁体   English

增加文件上传大小 Wordpress / IIS 7

[英]Increase File Upload Size Wordpress / IIS 7

I'm trying to increase the file upload size in a Wordpress blog to allow an admin to post his e-books and large PDF files.我正在尝试增加 Wordpress 博客中的文件上传大小,以允许管理员发布他的电子书和大型 PDF 文件。 The site is hosted on GoDaddy / IIS 7. I have tried the following with no luck: web.config: <configuration><system.webServer><security><requestFiltering><requestLimits maxAllowedContentLength="10000000"/></requestFiltering></security></system.webServer></configuration>该站点托管在 GoDaddy / IIS 7 上。我尝试了以下操作但没有成功: web.config: <configuration><system.webServer><security><requestFiltering><requestLimits maxAllowedContentLength="10000000"/></requestFiltering></security></system.webServer></configuration>

php.ini in root of site: upload_max_filesize = 64M网站根目录中的 php.ini: upload_max_filesize = 64M

Any advice is greatly appreciated.任何意见是极大的赞赏。 Thanks, Shawn谢谢,肖恩

Solution found here:解决方案在这里找到:

Step 1:第1步:

First, you need to edit your server's PHP.ini file.首先,您需要编辑服务器的 PHP.ini 文件。 This is found in your PHP installation directory, eg c:\\program files\\php\\php.ini and set the following values:这可以在您的 PHP 安装目录中找到,例如 c:\\program files\\php\\php.ini 并设置以下值:

upload_max_filesize = 64M upload_max_filesize = 64M
post_max_size = 64M post_max_size = 64M
max_execution_time = 300最大执行时间 = 300
max_input_time = 300最大输入时间 = 300

This allows PHP to handle files up to 64MB and allows PHP scripts to run up to 5 minutes before timing out.这允许 PHP 处理最大 64MB 的文件,并允许 PHP 脚本在超时前运行长达 5 分钟。

Step 2:第2步:

Lastly, IIS 7 has a default file upload limit of 30MB.最后,IIS 7 的默认文件上传限制为 30MB。 Anything larger than that will cause IIS to return a very unhelpful 404 status.任何大于此值的内容都会导致 IIS 返回非常无用的 404 状态。 You can read more about it at http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits您可以在http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits阅读更多相关信息

To override this, you need to change the web.config settings for (each) site.要覆盖此设置,您需要更改(每个)站点的 web.config 设置。 (The only catch here is that the limits are expected to be in bytes instead of kilobytes.) The following is some copypasta from the MSDN docs: (这里唯一的问题是限制应以字节而不是千字节为单位。)以下是 MSDN 文档中的一些 copypasta:

Don't forget to recycle your application pool so IIS picks up your PHP.ini changes.不要忘记回收您的应用程序池,以便 IIS 获取您的 PHP.ini 更改。

And that's it!就是这样!

http://refactored.tumblr.com/post/4609761388/wordpress-iis7-uploads http://refactored.tumblr.com/post/4609761388/wordpress-iis7-uploads

you will have to modify the active php.ini which you can get get from a phpinfo() and change both post_max_size and upload_max_filesize accordingly.您必须修改可以从 phpinfo() 获取的活动 php.ini 并相应地更改 post_max_size 和 upload_max_filesize。 Once done, restart iis完成后重启iis

I had to adapt the first solution above, because I am using Windows Share HostGator site.我不得不调整上面的第一个解决方案,因为我使用的是 Windows Share HostGator 站点。 I had a file in httpdocs called: .user.ini, which I added:我在 httpdocs 中有一个名为:.user.ini 的文件,我添加了:

upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 600
max_input_time = 600

Because I needed it bigger.因为我需要它更大。 I also added:我还补充道:

<security><requestFiltering><requestLimits maxAllowedContentLength="268435456"/> 
</requestFiltering></security>

So this allowed me upload larger files.所以这允许我上传更大的文件。 I wanted to be able to upload large videos or mp3 files.我希望能够上传大型视频或 mp3 文件。

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

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