Page 1 of 1
Image Deletion?
Posted: Thu Aug 15, 2002 1:08 pm
by JPlush76
ok I searched this site and the manual but perhaps i was just looking for the wrong thing...
I have an image upload script that works dandy, but I'd like the ability for the user to change their picture, I know how to do it from the database, but how do I clean that file off my server after they change it to the new pic?
mucho gracias
Posted: Thu Aug 15, 2002 1:18 pm
by llimllib
Posted: Thu Aug 15, 2002 2:12 pm
by fatalcure
yup, unlink will do the trick
you could also rename the new file to the same name again if they're updating the picture, so it'll take its place.
Posted: Thu Aug 15, 2002 2:13 pm
by JPlush76
oh really? it will just ovewrite the existing file?
I assumed it would generate an error because the file name is already there
that makes life alot easier
Posted: Thu Aug 15, 2002 2:17 pm
by fatalcure
nope, wont generate an error, unless you spit out an error yourself by actually checking to see if the file exists in the php script, so no other person can upload the same filename and overwrite something you dont want overwritten.
Posted: Thu Aug 15, 2002 2:28 pm
by JPlush76
that rocks
so when they sign up I'll just make sure that username is not already taken and just make the name of the image their username
