upload_func = 'copy';" to "$this->upload_func='move_upload"."/> upload_func = 'copy';" to "$this->upload_func='move_upload".">

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

What to do if phpcms attachment fails to upload

藏色散人
藏色散人Original
2020-01-07 10:42:042708browse

What to do if phpcms attachment fails to upload

What should I do if the phpcms attachment fails to upload?

The first solution: directly modify the apache configuration file. Modify the php.ini file (this method is only applicable to VPS, independent servers, or locally built environments, not applicable to virtual hosts, this is for reference only).

Change; extension=php_zip.dll to: extension=php_zip.dll. (That is, remove the ";" in the previous code)

The second solution: modify the attachment.class.php file.

Change $this->upload_func = 'copy';

to $this->upload_func = 'move_uploaded_file';

Warm reminder: This method may cause the image to be unable to be automatically saved remotely.

The third solution: modify the code file. Find the phpcms\modules\attachment\attachments.php file.

Replace the following code:

If(empty($this->userid)){

with:

if(empty($_POST[‘userid’])){

Save the upload and overwrite it before it can be solved. This method is submitted with administrator rights.

The fourth solution: comment code method. Find the phpcms\modules\attachment\attachments.php file.

Comment out all lines of code around 50-54. The specific commented out code is as follows:

//判断是否登录
If(empty($this->userid)){
exit(‘0’);
}

Delete or comment out these lines of code for now. Here it is determined that uploading can only be done after logging in. Otherwise, the return is a 0 exit, which means undefined.

The above 4 types are the four perfect solutions compiled by the editor to solve the undefined prompt when uploading pictures or attachments in phpcms.

PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!

The above is the detailed content of What to do if phpcms attachment fails to upload. 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