提供上传的多媒体内容的最佳方式
Best way to serve uploaded multimedia content
我目前正在开发一个允许上传图片和其他文件的网站。在这一点上我有几个疑问。
首先是,这些文件应该存储在哪里?我正在考虑将它们存储在文件系统中。
第二,上传多媒体文件的最正确方式是什么?如果你使用文件系统作为存储介质,你应该使用服务器上配置的静态路由还是其他更好的选择?
文件应该存储在哪里?
If the numbers of files are limited and not very much, then you can store it in the filesystem. However, if the number is large, I would recommend to store it in some storage service like AWS S3. Process could be either of two that you store temporarily the uploaded file in filesystem and then upload it in S3 or direct upload to S3. Depends on the use case.
上传多媒体文件的最正确方式是什么?
In case you are using services like S3, you just have to set content type and expiration among other metadata while uploading and rest everything will be taken care by S3 only. In case you are storing data on filesystem, then you can use nginx/apache to serve the static assets files along with proper content type and other metadata.
我目前正在开发一个允许上传图片和其他文件的网站。在这一点上我有几个疑问。
首先是,这些文件应该存储在哪里?我正在考虑将它们存储在文件系统中。
第二,上传多媒体文件的最正确方式是什么?如果你使用文件系统作为存储介质,你应该使用服务器上配置的静态路由还是其他更好的选择?
文件应该存储在哪里?
If the numbers of files are limited and not very much, then you can store it in the filesystem. However, if the number is large, I would recommend to store it in some storage service like AWS S3. Process could be either of two that you store temporarily the uploaded file in filesystem and then upload it in S3 or direct upload to S3. Depends on the use case.
上传多媒体文件的最正确方式是什么?
In case you are using services like S3, you just have to set content type and expiration among other metadata while uploading and rest everything will be taken care by S3 only. In case you are storing data on filesystem, then you can use nginx/apache to serve the static assets files along with proper content type and other metadata.