Solve wordpress file upload and download problems

Source: Internet
Author: User
Tags file size file upload ini php file phpinfo rar root directory wordpress blog

On the Internet some changes in wordpress file upload size restrictions, mostly a version, and said not accurate, especially for the novice guidance is not strong, this article summarizes the use of WordPress blog friends in the file upload and download the size limit, and file upload unsuccessful road Some problems to summarize and solve the method.

I. File upload size limit

The most effective way: you need to modify the PHP configuration to adjust the restrictions.

If the upload size is limited to 80M, add the following code to the PHP configuration:

File_uploads =on

Upload_max_filesize =80m

Post_max_size =80m

For different hosts, you need to modify the corresponding PHP version of the support: PHP4 modify php.ini file, PHP5 modify Php5.ini file.

Second, check the file upload size limit effective

There are two ways to recommend the first type.

1 Edit the phpinfo.php file and upload it to the server root directory, which reads:

<?php phpinfo ()?>

This allows you to check whether the PHP configuration changes are modified by accessing the phpinfo.php.

such as the site to visit the address: http://s6.hk/phpinfo.php

After the first step is completed, it may take a while to wait for the configuration to take effect, half a few minutes to one hours.

2 Refresh your wordpress background, into the multimedia upload interface, you will find that the upload file size has been changed to the size you set.

Iii. type of file is illegal

Modify the wordpress/wp-includes/functions.php file and add the following two lines to Get_allowed_mime_types ():

' 7z ' => ' application/x-7z-compressed ', ' rar ' => ' application/x-rar-compressed ',

In addition, consider the Wp_ext2type () method to increase the 7z type in the archive.

Four, the file can not download for some hosts uploaded files can not download the problem, the solution is to add the following in the. htaccess file:

AddType application/x-gzip. gz

AddType application/octet-stream 7zAddType application/octet-stream. zip

AddType application/octet-stream. rar

AddType application/octet-stream. msi

AddType application/octet-stream. exe

If the. htaccess file does not exist in the root directory, create a new upload to the server, and note that the permissions are set to 777.

Hint: In accordance with this article to modify the corresponding file, be sure to find out whether there is a related configuration, if there are modifications, no Add.

This article address:

Http://www.cnblogs.com/s6cn/p/3487788.html

See more highlights of this column: http://www.bianceng.cn/webkf/PHP/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.