I’m building a simple PHP file manager, and I need help getting files to be deleted.
Basically, how can I check to see if .filename checkbox is checked, where .filename is the class of the parent <tr>, as well as the name of the file, then if it is, when you click <input type="submit" name="delete" value="Delete Selected Files" />, delete the selected files from the /uploads/ directory.
I’m not using any kind of database or anything, just password protected areas on the site. I realize this isn’t the most secure way to do things.
I already have a script that populates a table like this:
<table>
<tr>
<td> </td>
<td>File Name:</td>
<td>File Size:</td>
</tr>
<tr class="filemane">
<td><input type="chekbox" /></td>
<td><a href="/uploads/file-name.ext" target="_blank">file-name.ext</a></td>
<td>10</td>
</tr>
</table>
<table>
<tr>
<td><input type="submit" name="upload" value="Upload Files" /></td>
<td><input type="submit" name="delete" value="Delete Selected Files" /></td>
</tr>
</table>
So I just need to know how to check which checkboxes are checked, and delete the related files from the /uploads/ directory.
You cam use:
HTML:
PHP: