0

Business purpose: I'm creating a CMS, and allowing the user to "delete" images that they've previously uploaded to the server.

Issue: if I allow them to really delete the images, they are left with old posts they've created with now-broken images. Example: user uploads vtWinsACC2005.jpg, writes an article about it linking to the image, then finally cleans up his gallery and deletes that image, but leaves the article alone, ending up with an article with a broken image.

Goal: when a user "deletes" an image they've previously uploaded, I want to add a "note" field, or any type of meta data to the actual file in IO, with something like, "hidden=true," and in my GetFiles() logic, I'll check to make sure that that metadata does not exist. This way, the user doesn't see the images they've deleted, and they could even "restore" images in the future that they did not mean to delete. When they restore, I can simply wipe the metadata from that file, and that's it.

Alternative: keep a simple lookup table in the database with userId + fileName, and call it "HiddenUserImage," but, the above way is more fun, and if I don't have to add another table, then great!

Any ideas?? This will be in C#. Thanks!

Ian Davis
  • 19,091
  • 30
  • 85
  • 133

1 Answers1

0

I think you can create for each image a NTFS Alternate Data Stream, a hidden ADS file that is mapped to your image file and store there the hidden=true property.

Stefan P.
  • 9,489
  • 6
  • 29
  • 43