pixelgirl Posted April 3, 2008 Share Posted April 3, 2008 Hey everyone, I have a handy little script that uploads up to three pictures to a particular folder on my filesystem. The script also resizes the pictures to a standard width ratio, and randomly generates and then saves the fielnames in my database so I can show the files on my webpage. My question is, when I am deleting files (if the user wants to change the pictures they have uploaded for example) I delete the filename entry from the database so I cant reference the filename any more, but how do I remove the file from the folder? Im not sure which section of the forum this question should go in, but I am coding in PHP so I thought someone might have some idea? Apololgies if this is in the wrong place. Any help is appreciated Quote Link to comment https://forums.phpfreaks.com/topic/99373-solved-deleting-files-from-filesystem-when-new-pictures-uploaded/ Share on other sites More sharing options...
rhodesa Posted April 3, 2008 Share Posted April 3, 2008 Well, before you remove the record from the db, I assume you know what the path to the local file is right? Then you just use unlink() to delete it from the filesystem Quote Link to comment https://forums.phpfreaks.com/topic/99373-solved-deleting-files-from-filesystem-when-new-pictures-uploaded/#findComment-508442 Share on other sites More sharing options...
haku Posted April 3, 2008 Share Posted April 3, 2008 http://jp.php.net/manual/en/function.unlink.php Quote Link to comment https://forums.phpfreaks.com/topic/99373-solved-deleting-files-from-filesystem-when-new-pictures-uploaded/#findComment-508443 Share on other sites More sharing options...
pixelgirl Posted April 3, 2008 Author Share Posted April 3, 2008 Thanks I had no idea how to remove it as I got the script from here (which has been very helpful) http://www.php-mysql-tutorial.com but it didnt explain about removing them. Quote Link to comment https://forums.phpfreaks.com/topic/99373-solved-deleting-files-from-filesystem-when-new-pictures-uploaded/#findComment-508456 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.