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 Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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?? Quote Link to comment 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.