DMXzone File System Connector Support Product Page


How do I delete a file along with a record?

Asked 07 Jun 2017 11:48:27
has this question
07 Jun 2017 11:48:27 Bruce Wilkie posted:
I've watched the video on how to delete when updating, but that relies on using the File upload to identify the 'path' of the file to delete. (

I'm just using a form to delete the record and then want to delete a file as well (and then a thumbnail of the file since it's an image in this case).

How do I identify the file/path to delete? I've added in a query that selects the file name from the database table using the file id as I thought I could then use this. But when I then add the next step, 'If File Exists' and click on the Dynamic lightning symbol for path, there's nothing in the 'DMXzone Server Connect - Data Bindings Pickup' window to select the file. Under 'Execute > Steps' there is the Database Query that I created, but I can't expand that any further to select the filename or path.

Similarly, if I miss out the 'If File Exists' step and try to just insert a 'File Remove' step I can only see the database query and can't drill down any further to get to the filename or path.

I'm adding the file deletion to an already working record deletion Server Action. Current steps are:

Database Connection
Delete Record (using hidden form field that holds the record id)

If I'm thinking right then adding file deletion to this, the steps should now be:

Database Connection
Database Query (to select the filename)
If File Exists (using filename selected)
Delete File (using filename selected)
Delete Record

Please can you let me know what I'm doing wrong?

I'm thinking I could create a second hidden field within the form that contains the filename and use that instead of a database query. Is that the only way or should I be using the database query the way I'm trying to do here?



Replied 07 Jun 2017 11:54:46
07 Jun 2017 11:54:46 Teodor Kuduschiev replied:
Hi Bruce,
Not sure what do you mean by: "that relies on using the File upload to identify the 'path' of the file to delete."

You need the file system connector extension, to delete a file, not the file upload extension. This is a similar video, the difference is it deleted a folder, instead a file, but the logic is pretty much the same:

Note that when creating a filtered query, you need a repeater step after it, with expression - the query itsel. to be able to get the query results. So put the delete file step in this repeat in server connect steps. Then you will be able to see the results from the query.
Replied 07 Jun 2017 12:07:26
07 Jun 2017 12:07:26 Bruce Wilkie replied:
Thanks Teodor

I'm leaving out the repeat region because I'm only deleting one record. Looking at the video you linked, at 2:33 you click the Dynamic button in order to select the folder path. And then it shows that you expand the repeat region and can select 'path'.

But I can only see the database query that I created for the single record, and I can't expand that at all to show any of the database fields.
Replied 07 Jun 2017 12:11:58
07 Jun 2017 12:11:58 Bruce Wilkie replied:

Hopefully can see screenshot above to see what I mean
Replied 07 Jun 2017 12:20:47
07 Jun 2017 12:20:47 Teodor Kuduschiev replied:
You always need the repeat step, to able to access query results. It does not matter if it is one file or more...
Replied 07 Jun 2017 12:24:41
07 Jun 2017 12:24:41 Bruce Wilkie replied:
Ok Thanks, will try that now
Replied 07 Jun 2017 12:57:48
07 Jun 2017 12:57:48 Bruce Wilkie replied:
OK, have added a repeat and can now expand the query when I add 'If File Exists'. Thanks for that Teodor.
Which field do I select to check if the file exists? I can see the filename but not the path. If I just select the filename how does it know which folder to check in to see if the file is there?

Screenshot below so you can see what I mean:

Replied 07 Jun 2017 13:00:21
07 Jun 2017 13:00:21 Teodor Kuduschiev replied:
Just enter the folder manually.
Replied 07 Jun 2017 13:09:44
07 Jun 2017 13:09:44 Bruce Wilkie replied:
OK, thanks Teodor.

Just done that. Unfortunately, now I've added in the file check and resulting file remove, when I click on delete it's not deleting the file and now it's no longer deleting the record either. On screen nothing happens.

Screenshot below again. Hopefully I'm nearly there

Replied 07 Jun 2017 13:14:02
07 Jun 2017 13:14:02 Teodor Kuduschiev replied:
Please provide a link to your page, with all of the output options enabled in the server connect steps. Also enable the debug mode in DW
Replied 07 Jun 2017 13:23:46
07 Jun 2017 13:23:46 Bruce Wilkie replied:
Page is at

I've just enabled output on all steps (what does that do by the way, not been able to find out?), and re-uploaded everything.

Not sure about enabling debugging in DW. Never used the facility and can't find it mentioned in google.
I'm using DW CC 2017. How do I enable debugging?
Replied 07 Jun 2017 13:25:16
07 Jun 2017 13:25:16 Teodor Kuduschiev replied:
What i mean is to enable the debug option, located in the settings of the Server Connect panel.
Replied 07 Jun 2017 13:30:52
07 Jun 2017 13:30:52 Bruce Wilkie replied:
Ah thanks. My mistake. Just done that now and uploaded again
Replied 07 Jun 2017 13:39:52
07 Jun 2017 13:39:52 Teodor Kuduschiev replied:
The error is:

Inalid path: ../images/gallery_pics/gallery_pic_36.jpg

Please , when browsing to the path, use the folder icon, so it can generate a proper path, then just manually enter the binding.
Replied 07 Jun 2017 13:49:41
07 Jun 2017 13:49:41 Bruce Wilkie replied:
Perfect! That's working just fine now

I noticed that when I used the browser, the result was '/images/gallery_pics/' whereas when I typed it in manually I entered it with two dots at the start ('../images/gallery_pics/') since my source file was in a subfolder and so stepped back one to the root folder to then go into the images folder.

I'm guessing that the problem is that I was assuming that gallery.htm is the source file, but maybe it's the js file that's generated by the dmx extension is the actual souce file for this. And that's in a different location. Would that be right?
Replied 07 Jun 2017 13:53:27
07 Jun 2017 13:53:27 Teodor Kuduschiev replied:
The path the extension generates is from the server root, as our file-related extensions are always using paths relative to server root.
Replied 07 Jun 2017 14:16:31
07 Jun 2017 14:16:31 Bruce Wilkie replied:
OK, I understand. All working now

Thanks very much for you help Teodor

Replied 07 Jun 2017 16:00:23
07 Jun 2017 16:00:23 Bruce Wilkie replied:
Hi again Teodor

This is going to sound really stupid, but how do I link to another page to edit this record from within the repeat region?

I've tried with a regular link: <p><a href="gallery-edit.php?edit_pic_id={{pic_id}}">Edit</a>
but that just takes me to the url: gallery-edit.php?edit_pic_id={{pic_id}}

I've also tried with a form and button:
<form action="gallery-edit.htm" method="get" name="form2" id="form2">
<input name="edit_pic_id" type="text" id="edit_pic_id" size="3" dmx-bind:value="pic_id">
<input type="submit" name="submit" id="submit" value="Edit">
But nothing at all happens when I click on the button. It doesn't even try to link to the gallery-edit.htm page.

If you need to look, it's all still at

Any ideas what I'm doing wrong?

Replied 07 Jun 2017 17:59:24
07 Jun 2017 17:59:24 Teodor Kuduschiev replied:
Hi Bruce,
Please do not try to assign dynamic values manually, but use the app connect panel for this. Check this video please:
Replied 08 Jun 2017 14:38:06
08 Jun 2017 14:38:06 Bruce Wilkie replied:
Hi Teodor

I've followed the video but at 1:14 it says to select the link and add a dynamic attribute.
I don't have that option when I select the link. In the App Connect properties window I can only insert a binding.
Have I done something wrong?

Screenshot below:

Replied 08 Jun 2017 14:49:57
08 Jun 2017 14:49:57 Teodor Kuduschiev replied:
Well, you clicked inside the link on this screenshot. Make sure to select the <a> tag in DW properties inspector, so it can see that you've selected it. We rely on what DW sees as selected on your page.
Replied 09 Jun 2017 10:31:48
09 Jun 2017 10:31:48 Bruce Wilkie replied:
Thanks Teodor. Simple mistake on my part. Got it now.

Out of interest, which manual does that "Details Page, Filterd by an URL Parameter" come under?

I really struggle trying to find videos for what I'm trying to do with the extensions. Is there a single page showing all the extensions and what videos appear in the manuals for each one?

Reply to this topic