简体   繁体   English

Laravel 项目托管:文件上传和图片目录

[英]Laravel project hosting: file uploads and images directory

I am done with a Laravel project and I plan to host it on AWS EC2.我已经完成了一个 Laravel 项目,我计划将它托管在 AWS EC2 上。 I am still learning how that works.我仍在学习它是如何工作的。 My project includes file uploading.我的项目包括文件上传。 I upload my files in Laravel's public folder.我将我的文件上传到 Laravel 的公共文件夹中。 Similarly, I store some images in the public folder and use laravel's asset function in the img tag to retrieve it.同样的,我在public文件夹中存放了一些图片,在img标签中使用laravel的asset函数进行检索。 I am worried nonetheless that these paths would not be recognized when I host my application.尽管如此,我还是担心在我托管应用程序时无法识别这些路径。 Am I using the correct directory to store my images and uploaded files?我是否使用正确的目录来存储我的图像和上传的文件?

If not which local directory should the images and files be stored?如果不是,图像和文件应该存储在哪个本地目录?

公共文件夹是正确的,它会自动访问图像,以防万一您的图像无法访问,那么您需要运行命令php artisan storage:link它将您的文件夹链接为存储,然后您需要将存储文件夹权限设置为 777 然后它会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM