View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Delete orphaned files and images

Thread began 10/28/2009 1:45 am by troyd | Last modified 11/03/2009 12:04 am by troyd | 2707 views | 16 replies


Wow, I did it!

Using a combination of suggestions from Jason, Brian and some from "Vacunita" in another PHP forum (would like to give credit for them but not sure if it's allowed), I now have a single page that sees all files in a directory, displays them with check boxes and deletes them if checked. No Record Set or Table required.

Basically I used DFP's delete file behavior but instead of referencing a hidden field, I referenced the checkbox value. And the check box value is assigned dynamically.

I set the form action to "" and post. Then set the trigger for the DFP behavior to "any form post".

Now I just need to figure out how to show ONLY image files. Because, as it is now, all files are showing up and can be deleted.

Here's a generic example of what I did with everyone's help. Thanks again, TroyD

<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>

$WA_DeleteFileResult1 WA_FileAssist_DeleteFile("images/""".((isset($_POST["image"]))?$_POST["image"]:"")  ."");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
img {
    width: 150px;
<form  action="" method="post" enctype="multipart/form-data">
if (
$handle opendir($mydir)) {

"Images:\n <table><tr><td>Delete</td><td>Filename</td></tr>";

    while (
false !== ($file readdir($handle))) {
"<tr><td><input type='checkbox' name='image' value='$file'></td><td><img  src='$file'></td><td><img  src='images/$file' /></td><td>$file</td></tr>";

  <input name="Delete" type="submit" value="Delete" />

One thing to note for anyone still learning like me. When you go to the DFP delete behavior and click on the lightning bolt next to File name:, you won't see the check box as an option. That's because it's not recognized yet by the form since it has to be echoed I think. So I just typed in the name of the check box, in this case "image". Once it's on the server, then the check box becomes a recognized form element. (If that's not correct, please let me know).

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...