将文档(pdf,word ...)存储在数据库中的最佳方法(Postgres 9.4) [英] Best way to store documents ( pdf , word ...) in a database ( postgres 9.4)

查看:689
本文介绍了将文档(pdf,word ...)存储在数据库中的最佳方法(Postgres 9.4)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:


  • 要保存诸如pdf文件或word之类的文档...

方法:


  • 但是在我看来,直接将其存储在数据库中并不是一个好主意。

  • 我更喜欢仅将文件地址存储在列中,并将文件本身保存在文件夹中在我的数据库旁边。

Todo:


  • 是否有一个技巧可以在数据库(mdf ldf)旁边创建一个文件夹,并将其相对地存储到我指的mdf(.. / document)中?

推荐答案

在阅读所有评论后

假设我们的网站 xyz.com/index.html 用于生产,
xyz.com/Dev/index.html 用于开发

suppose our website is xyz.com/index.html for Production and xyz.com/Dev/index.html for Development

在此应用程序下,我们将有一个文件夹 / Doc
用于生产应用程序路径 xyz.com /
和开发应用程序路径将为 xyz.com/Dev /

under this application we would have one folder /Doc for production application path would be xyz.com/ and Development application path would be xyz.com/Dev/

我们将路径保存在 DB表列中,将路径保存为 DOC /doc1.pdf 等...
,当我们从数据库中获取数据时,我们必须在客户端
上编写一个代码,该代码将是应用程序路径+列中的数据库路径

we will save the path in DB table colummn is DOC/doc1.pdf etc ... when we bring the data from DB then we have to write a code on client end that would be application path + DB path in column

生产路径将为 xyz.com/DOC/doc1.pdf
的开发路径为 xyz.com/Dev/DOC/doc1.pdf
,因此您将始终获得正确的路径在网站上显示您的文档

for Production path would be xyz.com/DOC/doc1.pdf and for Development path would be xyz.com/Dev/DOC/doc1.pdf so you will get always right path to show your doc on websites

这篇关于将文档(pdf,word ...)存储在数据库中的最佳方法(Postgres 9.4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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