Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
386 views
in Technique[技术] by (71.8m points)

php - Where to store uploaded files (sound, pictures and video)

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,

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...