douzhang2092
2018-12-06 16:39
浏览 254
已采纳

如何在Lumen的浏览器中访问上传的文件

I can successfully upload files to the /storage/app folder but now I'm wondering how I can view these (image) files in the browser.

I've setup a symlink /public/storage that points to /storage/app

I'm trying to access the file through http://my-local-domain/storage/myphoto.jpg but it's giving me a NotFoundHttpException.

I know this works in Laravel, but not sure how to get this working in Lumen. Am I missing something?

Thanks.

图片转代码服务由CSDN问答提供 功能建议

我可以成功将文件上传到/ storage / app文件夹,但现在我想知道如何查看这些文件( 图片)浏览器中的文件。

我已经设置了指向/ storage / app的符号链接/公共/存储

我正在尝试通过 http://my-local-domain/storage/myphoto.jpg 但它给了我一个 NotFoundHttpException。

我知道这在Laravel中有效,但不知道如何在Lumen中使用它。 我错过了什么吗?

谢谢。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongsi4547 2018-12-06 16:56
    已采纳

    Sorry, my bad. My symlink was incorrect. I executed this command (my current path was the root of my application):

    ln -s storage/app public/storage
    

    This should be (complete paths):

    ln -s /var/www/storage/app /var/www/public/storage
    
    打赏 评论

相关推荐 更多相似问题