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

问题描述

我想保存文档,如pdf文件或word ...
,但似乎在我看来不是一个好主意直接存储在数据库中。
我更喜欢只将文件的地址存储在列中,并将文件本身保存在数据库旁边的文件夹中。
有一个技巧在数据库(mdf ldf)旁边创建一个文件夹并将相对地存储到mdf I mean(.. / document)中?



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



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



我们将保存路径在 DB table colummn is DOC / doc1.pdf etc ...
当我们从DB中提取数据时,我们必须在客户端上编写一个代码
,这将是应用程序路径+ DB路径在列



生产路径将是 xyz.com/DOC/doc1.pdf
的开发路径将是 xyz.com/Dev/DOC/doc1.pdf
,向右路径在网站上显示您的文档


I would like to save documents such a pdf file or word...but it seems to me not a good idea to store it directly in the database.I prefer to store only the address of the file in a column and to save the file itself on a folder beside my database.there is a trick to create a folder beside the database (mdf ldf) and to store the relativly to the mdf I mean (.. /document) for example?

解决方案

after read all comments

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

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

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 endthat would be application path + DB path in column

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

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

09-05 05:55