List all uploaded file with Delete option

Hello guys,

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.
so in javascript, del() function i’m getting filename and that name i’m sending to delete.php file through ajax post method.

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 !



6 thoughts on “List all uploaded file with Delete option

  1. everything is very open and very clear explanation of issues. it contains truly information. your website is very useful. thanks for sharing. looking forward to more!

    • because if i write code which contain html inside post area, then it consider as htmlcode and instead of displaying code it generate html widget in post 😦

      that’s problem i’m facing while posting some html code. if you have any idea about how to avoid this problem please tell me.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s