I am trying to create a form like the one we ask questions in, but with image & video Upload facility.
I am making Admin Support pages for a CMS. When the admin uploads an image, the name of the uploaded file can be seen in the textarea and the Image will be become visible on the customer pages.

After the file's usefullness, the admin may decide to remove the file from his webpage and deletes the link from his text box.
When that happens, the file will not be shown on the admin/user pages, but it still exists in my server.
How do I delete such useless files?
If you can find a way for the useless files to be deleted as the Admin deletes the links, it will be very helpful.

For a better understanding, checkout stackoverflow.com question form.

Well if you have stored information about where these files are saved with your link, I guess you could retrieve this information when you delete the link, and delete the related files with it?

You can use the unlink() function for deleting files :).

Its not that simple. Have a look at the stackoverflow.com question form. YOu will get a better idea.
The solution is not that simple, or else I would have got it by now. :P