上载文件(声音,图片和视频)的存储位置 [英] Where to store uploaded files (sound, pictures and video)

查看:98
本文介绍了上载文件(声音,图片和视频)的存储位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前段时间,我不得不开发一个音乐站点,该站点允许将音频文件上传到站点,然后使用ffmpeg将其转换为各种格式,然后人们在购买了已上传的音频文件后便会下载它们,而tmp文件会创建并放置在下载位置,并且仅对每个下载实例有效,然后tmp文件将被删除.

A while a go I had to developed a music site that allowed audio files to be uploaded to a site and then converted in to various formats using ffmpeg, people would then download the uploaded audio files after purchasing them and a tmp file would be created and placed at the download location and was only valid for each download instance and the tmp file would then get deleted.

现在我正在重新访问该项目,我还必须添加图片和视频作为上传内容.

Now I am revisiting the project, I have to add pictures and video as upload content also.

我想找到存储文件的最佳方法,

I want to find the best method for storing the files,

选项1:将文件存储在文件夹中,并在数据库中引用它们

option 1 : storing the files in a folder and reference them in the database

选项2:将实际文件作为blob存储在数据库(mysql)中.

option 2 : storing the actual file in the database(mysql) as blob.

我正在考虑这个想法,以考虑每种方法的安全性以及其他我可能没有计算出来的问题.

I am toying around with this idea to consider the security implications of each method, and other issues I might have not calculated for.

推荐答案

请参阅前面的StackOverflow问题

See this earlier StackOverflow question Storing images in a database, Yea or nay?.

我知道您提到图像和视频,但是此问题与所有大型二进制内容媒体文件有关.

I know you mentioned images and video, however this question has relevance to all large binary content media files.

共识似乎是在文件系统上存储图像的文件路径,而不是实际的图像.

The consensus seems to be that storing file paths to the images on the filesystem, rather then the actual images is the way to go.

这篇关于上载文件(声音,图片和视频)的存储位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆