Use Request::File('image'); in Controller in thinkphp
Finestudio JZ
Finestudio JZ 2021-08-23 10:24:31
0
6
1545

View

index.png

Controller

controller.png

##Error

error.png

Error: The return value of Request::File('image'); is null.

How to get the uploaded image path?

Finestudio JZ
Finestudio JZ

reply all(2)
逆旅行人

image.png

$img='<img src='."Your own corresponding path"; ​

$img.='>'; ​

echo $img;

Follow this output and see if your image can be displayed normally. This will help you see if your path is correct

  • reply Pictures can be displayed normally
    Finestudio JZ author 2021-08-24 10:19:37
逆旅行人

If the upload root directory configured in the config/filesystem.php configuration file is not changed, the default storage runtime/storage/topic/, if there are multiple applications, it should be runtime/index/storage

  • reply I saw this in the manual. So how to modify this?
    Finestudio JZ author 2021-08-23 16:45:23
  • reply I added ‘/index’ in front of ‘storage’ but it didn’t work and I still got an error.
    Finestudio JZ author 2021-08-23 16:47:33
  • reply You can get the path, save it in another place, and then delete the original one, that's all.
    小李大人 author 2021-09-14 09:41:13
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template