SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Apr 2010
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Deleting images in database and web server

    I am setting up a CMS where the user can upload images to be used in a slideshow. In the slideshow, when each image is displayed there will be an accompanying text displayed.

    The database will store the image name and accompanying text. I want the user to be able to add and delete images. If they delete an image, I want this to be removed from the image folder. If the slideshow is only going to have 5 images, would it be best to store the images on the database or is there an easy way to allow a user to delete the image from an image folder as well as the database?

    Apologies for the lengthy question.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Hlforr View Post
    would it be best to store the images on the database or is there an easy way to allow a user to delete the image from an image folder as well as the database?
    You should not store the image data in the database. Store a link to the image location, but not the actual image.

    When a user wants to delete a picture, SELECT the link to the file, unlink it, and then DELETE the row from the table.

  3. #3
    SitePoint Addict
    Join Date
    Apr 2010
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem with this is that I could be left with dozens of images in an image folder that are no longer used, thus taking up valuable server space

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Click the link in my previous post.

  5. #5
    SitePoint Addict
    Join Date
    Apr 2010
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Apologies, Yes that is exactly what I need. Many thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •