robert_gsfame Posted September 25, 2009 Share Posted September 25, 2009 hello all, i would like to find some solution regarding uploaded file If user has upload let say an image in jpg and he wants to remove the file, then how to remove not only the file's name in the table and changing it into NULL but also the chosen file inside my uploaded folder?? do i need to use unlink or maybe u have some other method?? thx Link to comment https://forums.phpfreaks.com/topic/175456-solved-remove-uploaded-file-from-folder/ Share on other sites More sharing options...
hamza Posted September 25, 2009 Share Posted September 25, 2009 Yeah to remove FILE OR ANY KIND OF IMG FROM DIR YOU CAN USE ULINK FUCtion hope you family with this fucktion . by using diropen you can open up the directory and get file name and remove it from uploaded directory. use SIMPLE UPDATE QUERY TO insert NULL IN DB TABLE . IF THIS IS NOT ENOUGH TO KNOW THEN SHOW YOUR CODE AND ELABORATE YOUR ANSWER IN DETAIL Link to comment https://forums.phpfreaks.com/topic/175456-solved-remove-uploaded-file-from-folder/#findComment-924588 Share on other sites More sharing options...
robert_gsfame Posted September 25, 2009 Author Share Posted September 25, 2009 yeah thanks i am familiar with fdir.....Just want to make sure whether there is another method of removing uploaded file Link to comment https://forums.phpfreaks.com/topic/175456-solved-remove-uploaded-file-from-folder/#findComment-924614 Share on other sites More sharing options...
JasonLewis Posted September 25, 2009 Share Posted September 25, 2009 Just grab the filename from the database, then use file_exists() to make sure the file exists, then unlink() to remove the file. Then clear the data from the DB. Link to comment https://forums.phpfreaks.com/topic/175456-solved-remove-uploaded-file-from-folder/#findComment-924626 Share on other sites More sharing options...
robert_gsfame Posted September 25, 2009 Author Share Posted September 25, 2009 let say $uploader is my record retrieved from my table and $filename1 is my HTTP_POST[filename][name] if((!empty($uploader))&&($filename1!=$uploader)){ unlink("folder/".$uploader);} how come it didn't work?? Link to comment https://forums.phpfreaks.com/topic/175456-solved-remove-uploaded-file-from-folder/#findComment-924776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.