Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    75
    Thanks
    9
    Thanked 2 Times in 2 Posts

    how to make image delete

    hello not sure if this the right place

    but
    I'm trying to find a way to add a delete image button but unsure how to do it
    I already got a edit photo area where you upload more images or remove the whole lot
    but I want make it also delete just selected images how would I do that

    Many Thank for replies

  • #2
    New Coder
    Join Date
    Dec 2012
    Location
    USA
    Posts
    82
    Thanks
    3
    Thanked 17 Times in 17 Posts
    You would need to take advantage of the unlink() function.

    Be careful not to allow someone with malicious intent to delete your entire website

  • #3
    New Coder
    Join Date
    Feb 2011
    Posts
    75
    Thanks
    9
    Thanked 2 Times in 2 Posts
    ok thanks I will look init before I add it to my site as my site is a social network

    Many Thanks for the info

  • #4
    New Coder
    Join Date
    Feb 2011
    Posts
    75
    Thanks
    9
    Thanked 2 Times in 2 Posts
    unlink is remove file?
    if so can I not just delete the mysql bit and leave the file intacted?
    that way the site files cant be touch or is it the mysql I got to worries about too?

  • #5
    New Coder
    Join Date
    Dec 2012
    Location
    USA
    Posts
    82
    Thanks
    3
    Thanked 17 Times in 17 Posts
    Yes, unlink() deletes the designated file.

    You should be a little more clear in your intentions. So you are storing the file path in a mysql database?

    If so, then yes you can remove the file path and leave the image intact. That would use the UPDATE or DELETE query.

    As long as you use the MySQLi or PDO libraries with prepared statements you should be fine

  • Users who have thanked TFlan for this post:

    Whatnot (01-31-2013)


  •  

    Posting Permissions

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