1

How to bring consistency to the data while storing binary data in the file system and its reference in the database?

Is there any database design technique/pattern or any PHP library to help me on bringing consistency to the data with database and file system collaborated architecture used for data storing?

I mean database must be aware of any changes to the data in file system so how to deny changes without the database awareness?

Note: I am using PHP and MySQL with Apache2

Sabawoon
  • 25
  • 6
  • 3
    Self disipline is key here. No really, there's no way to prevent changes in the file system, apart from permissions. So simply don't touch the files other then by the routines that were designed to do so. (Oh, and make backups, lots of backups!) – KIKO Software Aug 21 '16 at 12:35
  • @KIKOSoftware Thanks for your quick tips. – Sabawoon Aug 21 '16 at 12:46

1 Answers1

0

Change your FTP password or limit access to the upload folder. This way all your changes will only happen through the application which will handle updates on both filesystem and database.

Boris Schegolev
  • 3,601
  • 5
  • 21
  • 34
  • Thanks for your answer. – Sabawoon Aug 21 '16 at 12:49
  • But you said something which I already know, the problem is if there are many FTP users who are also manipulating the content in these directories so what to do then, however I will vote it up. – Sabawoon Aug 21 '16 at 13:00
  • But I can't vote it up because vote require at least 15 reputation. – Sabawoon Aug 21 '16 at 13:01
  • Well, that's a question of policy then. If other people need to upload files into the directory using FTP, then you can not do much about it. But if it is let's say other developers deploying the application, then they have no interest in upload folder and you can lock it to yourself (read-only to others). – Boris Schegolev Aug 21 '16 at 13:27