Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-31-2013, 08:25 PM   PM User | #1
Whatnot
New Coder

 
Join Date: Feb 2011
Posts: 69
Thanks: 7
Thanked 1 Time in 1 Post
Whatnot is an unknown quantity at this point
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
Whatnot is offline   Reply With Quote
Old 01-31-2013, 08:38 PM   PM User | #2
TFlan
New Coder

 
Join Date: Dec 2012
Location: USA
Posts: 82
Thanks: 3
Thanked 17 Times in 17 Posts
TFlan is an unknown quantity at this point
You would need to take advantage of the unlink() function.

Be careful not to allow someone with malicious intent to delete your entire website
TFlan is offline   Reply With Quote
Old 01-31-2013, 09:18 PM   PM User | #3
Whatnot
New Coder

 
Join Date: Feb 2011
Posts: 69
Thanks: 7
Thanked 1 Time in 1 Post
Whatnot is an unknown quantity at this point
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
Whatnot is offline   Reply With Quote
Old 01-31-2013, 09:54 PM   PM User | #4
Whatnot
New Coder

 
Join Date: Feb 2011
Posts: 69
Thanks: 7
Thanked 1 Time in 1 Post
Whatnot is an unknown quantity at this point
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?
Whatnot is offline   Reply With Quote
Old 01-31-2013, 10:01 PM   PM User | #5
TFlan
New Coder

 
Join Date: Dec 2012
Location: USA
Posts: 82
Thanks: 3
Thanked 17 Times in 17 Posts
TFlan is an unknown quantity at this point
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
TFlan is offline   Reply With Quote
Users who have thanked TFlan for this post:
Whatnot (01-31-2013)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:52 PM.


Advertisement
Log in to turn off these ads.