Home  >  Article  >  CMS Tutorial  >  What to do if phpcms file upload fails

What to do if phpcms file upload fails

王林
王林Original
2020-02-08 17:19:072319browse

What to do if phpcms file upload fails

The reasons are as follows:

1. The configuration parameters of the server PHP are incorrect.

In the php.ini configuration file, if the parameter values ​​of upload_max_filesize and post_max_size are set improperly, it may limit the upper limit of the file size you can upload, causing the upload to fail and return an exception. Symptoms are often that small files, pictures, etc. can be uploaded normally, but large files will fail.

The solution is also very simple. Find the php.ini in the server and set all upload-related parameter values ​​to reasonable values.

1. Modify phpcms background configuration

phpcms background--site settings--modify--attachment settings--allow attachment size, enter a value such as 10240. (This value can be the size you want)

2. Modify the php.ini file configuration

(1) Open the php configuration file php.ini, search for upload_max_filesize, and change the value of this to 10240. (As above, the value can be changed as needed)

(2) Continue to search for post_max_size in php.ini and change this value to 30000. (The maximum limit for form submission. This item does not limit the size of a single uploaded file, but limits the data submitted by the entire form.)

Note: Be sure to ensure that post_max_size >= upload_max_filesize, also That is, the former must be greater than the latter. Be sure to restart the web service after modification. Must restart.

2. Upload failure caused by file read and write permissions

Make sure that the uploadfile directory has read and write permissions.

3. The secondary development of the background PHP program resulted in an incorrect upload return value, which could not be correctly parsed by the swfupload plug-in.

You can observe whether there are exceptions through the response value in firebug.

4. No permission to upload due to expired membership rights or session.

Related recommendations: phpcms tutorial

The above is the detailed content of What to do if phpcms file upload fails. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn