drccfl9407 2011-09-15 09:46
浏览 59

php,mysql - 用于文档管理的文件夹/文件组织

I was wondering what would be the good way to organize documents in a filesystem for my php/mysql application. All info of the docs are stored in a db i am curious about filesystem organization. Is this good way to do it? Is there a better way?

Main folder

/documents

One folder per client

/documents/client1

Documents are uploaded here per client

/documents/client1/queue

After users fill the form docs are saved to a database and moved in this folder

/documents/client1/docs

Original and filesystem names of the document are stored in a database and filesystem name is something like md5($time.$filename.$client_id) and the document path looks like this

/documents/client1/docs/6f99caa11e78697612d8f1b4481cd76a.pdf

I need (minimum) first page of pdf for the thumb and auto barcode reading from the first page

/documents/client1/docs/6f99caa11e78697612d8f1b4481cd76a/6f99caa11e78697612d8f1b4481cd76a-0.gif

I also have

/documents/client1/scan

where files from the scanner goes so users can import them in the database and after that they are renamed and moved to: /documents/client1/docs

I wonder if i should put files for specific date in a date folder like this:

/documents/client1/docs/20110915/6f99caa11e78697612d8f1b4481cd76a.pdf

Or should i use completely different folder structure?

  • 写回答

2条回答 默认 最新

  • dongqindan4406 2011-09-15 09:57
    关注

    Why not using only one common folder for temporary (uploaded) files ? It could make maintenance routine easier (for example deleting all old files).

    I wonder if i should put files for specific date in a date folder like this:

    /documents/client1/docs/20110915/6f99caa11e78697612d8f1b4481cd76a.pdf

    If the date is handled by your database it's needless. Nevertheless if for some reason you need to access this file manually (not using your interface) it could be helpful...

    Last but not least be aware of your filesystem's limitation. On some filesytem/os you could have a limitation on the number of file per folder (huge but still).

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)