在Web应用程序中存储图像或pdf的最佳方法是什么? [英] What is the best way to store images or pdfs in web application?

查看:73
本文介绍了在Web应用程序中存储图像或pdf的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



亲爱的,

当我们将图像或pdf存储在应用程序文件夹中时,我们遇到了应用程序速度减慢的问题。当我们存储在数据库中时,数据库的大小日益增加,那么存储图像/ pdf的最佳方式是什么。



提前谢谢.......

推荐答案

这完全取决于你存储它们的原因。
就个人而言,我将它用于文档,更改通知等等,所以我需要多份副本。

我使用数据库和文件的组合:

文件本身存储在GUID文件名下的文件夹(root / Resources / Documents)中,以及该文件的路径,原始文件名,版本和日期信息存储在数据库中。



这允许我使用简单SQL查询引用所有内容的最新版本,并从查询结果中访问文件,而不必引用文件系统列出我的文件或占用太多的数据库空间。
That's going to depend entirely on why you are storing them.
Personally, I use it for documentation, change notices, and so forth so I need multiple copies available.
I use a combination of database and files:
The files themselves are stored in a folder (root/Resources/Documents) under a GUID filename, and the path to that file, the original file name, the version, and date information is stored in the DB.

This allows me to reference the latest version of everything with a "simple" SQL query, and access the files from the query results, without having to reference the file system to list my files or take too much DB space.


这篇关于在Web应用程序中存储图像或pdf的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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