Today, one of my friend asked me to display the uploaded files from folder with delete option. so i write below code, which i gonna share with u people.
so here, i’m creating delete button for each file with unique id(filename), when user press on button i’m passing id(filename) to del() function.
now let’s have a look on delete.php
in this file, i’m checking whether $fname is file-name or directory-name. if it is file name then i’m deleting that particular file using unlink() function otherwise one error message will display to end user.
Note: you must have test folder in your current directory if you are following this same code. otherwise you can change name of your whatever folder-name.
hope you all like this !