search

Home  >  Q&A  >  body text

Use Request::File('image'); in Controller in thinkphp

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 JZFinestudio JZ1222 days ago1564

reply all(6)I'll reply

  • autoload

    autoload2021-08-24 10:10:57

    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
    0
  • Finestudio JZ

    Pictures can be displayed normally

    Finestudio JZ · 2021-08-24 10:19:37
  • autoload

    autoload2021-08-23 13:53:33

    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
    0
  • Finestudio JZ

    I saw this in the manual. So how to modify this?

    Finestudio JZ · 2021-08-23 16:45:23
    Finestudio JZ

    I added ‘/index’ in front of ‘storage’ but it didn’t work and I still got an error.

    Finestudio JZ · 2021-08-23 16:47:33
    小李大人

    You can get the path, save it in another place, and then delete the original one, that's all.

    小李大人 · 2021-09-14 09:41:13
  • Cancelreply