Home  >  Article  >  Backend Development  >  What should I do if php ueditor cannot create the file?

What should I do if php ueditor cannot create the file?

藏色散人
藏色散人Original
2020-08-21 10:56:202459browse

php ueditor cannot create files because there is a problem with folder permissions. The solution is to change the folder permissions by executing the command "chmod 0777 image/;".

What should I do if php ueditor cannot create the file?

Recommended: "PHP Video Tutorial"

The problem of not being able to create a directory using ueditor

【Preface】

I recently used ueditor, a js plug-in launched by Baidu, for background article editing. However, some problems were encountered during use:

There was no problem when using it locally, but problems occurred after the project was migrated to the server: when inserting pictures into the article, it always showed that the directory creation failed.

【Subject】

Next, analyze the problem:

First, each ueditor must be assigned a specific id when it is created, and After the creation is successful, it must be specifically destroyed after completing the specific function. Otherwise, the ueditor is generated through an event such as onclick. If the first one wants to create the second one without being destroyed, it will fail.

When I use ueditor to upload images when publishing an article, I always get an error: Failed to create the upload directory.

Found after opening fiddler to grab the request. After adding an image, ueditor will send an asynchronous image upload request to /ueditor/php/controller.php. After tracing the source code, I found that an error was returned when creating the directory. Print the error message after mkdir's Permission denied. I know it's a folder permissions issue. Since it is a problem with directory permissions, then find the directory and modify the permissions before uploading. The result is successful.

【Permission modification】

Use the command

chmod 0777 image/;

to change the folder permissions.

The above is the detailed content of What should I do if php ueditor cannot create the file?. 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