Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Delete Select Files

Explorer ,
Nov 05, 2009 Nov 05, 2009

I need to delete files based on a checkbox selection. It looks at though the code works but it doesn't actually delete the file. Not sure where I've gone wrong. Any help with this would be great. Thanks.

Here is the first page, user_delete.cfm contains this code:

<form action="delete_submit.cfm" method="post" enctype="multipart/form-data" name="importform" id="importform">

     <input type="checkbox" name="filelist" value="#URLEncodedFormat(dir.name)#" class="formfield"/>#dir.name#

     <input type="submit" name="Delete" class="formbutton" value="Delete Checked" onclick="return confirm('Are you sure you want to delete the checked errors? This action cannot be reversed.');"/> 

</form>

Here is the delete_submit.cfm page:

            <cfparam name="attributes.Delete" default="">
            <cfparam name="filestoremove" default="">
           
            <cfif attributes.Delete IS "Delete Checked" AND isDefined("attributes.filelist")>
                <cfset filestoremove = attributes.filelist>
            </cfif>
                       
            <cfloop list="#filestoremove#" index="item">
                <cffile action="Delete" file="E:\WEB\bkllp\manage\users\#GetName.accountant#\#fileLoc#\#urlDecode(item)#">
            </cfloop>         

I know that #GetName.accountant# and the #fileLoc# are correct...

TOPICS
Advanced techniques
410
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 05, 2009 Nov 05, 2009
LATEST

Is the <cfloop> code definitely running?

<cffile> is good in that if anything at all happens that it doesn't like, it'll throw an exception quick smart.

So if the functionality is not working and you'renot getting an error... I reckon the <cffile> ain't actually being called.

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources