In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to solve the php prompt upload root directory does not exist, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Php prompts the solution for uploading the root directory that does not exist: first give root permissions to check if the problem is resolved; if the problem is not resolved, use the mkdir command to create a new folder; finally, give the newly created folder the highest permissions.
This article operating environment: windows10 system, php 7, thinkpad T480 computer.
Problem recovery:
After trying to upload the picture, I was prompted: "the upload root does not exist! please try to create it manually."
Solution:
Try to give permission first, and delete the folder if you still can't solve the problem. Then use the mkdir command to create a new folder and grant 777 permissions.
Question 2:
The following problems are encountered in the development process of uploading images with ThinkPHP3:
Upload root directory does not exist! Please try to manually create a picture uploaded by. / Uploads/; with garbled names in Chinese. When uploading a file, a folder named with the current date will be automatically generated and saved in it.
Note: the development environment is Xampp under Windows
Attach the code before the problem is resolved:
Here are the solutions to three problems:
Question 1
When checking the information, some netizens said that this is a folder permission problem, which can be solved in the following ways:
For example, if you want to save the uploaded image to the. / Uploads directory, set rootPath to'. / 'and change savePath to the path you want to save. So the final save directory path is. / Uploads/1/.
$upload- > rootPath = ". /"; $upload- > savePath = "Uploads/$uid/"
Question 2
Locate the save method in the file ThinkPHP\ Library\ Think\ Upload\ Driver\ Local.class.php:
Set
If (! move_uploaded_file ($file ['tmp_name'], $filename))
Change to
If (! move_uploaded_file ($file ['tmp_name'], iconv (' utf-8','gb2312',$filename)
Question 3
When uploading, the default is to automatically use a subdirectory to save the uploaded file, that is, $upload- > autoSub = true; and set it to false.
Add the following code to the upload parameters in the code:
$upload- > autoSub = false; Thank you for reading this article carefully. I hope the article "how to solve the problem of uploading the root directory of php tips" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.