Delete multiple files with CFFILE
Posted on 2006-07-12
I have a page which shows a list of images in a table,
output from a cfdirectory function.
I currently have it working with radio buttons - select one image,
click delete button, and form processes back to same page, performing and confirming the deletion.
I want to change this to use checkboxes, and allow multiple deletions.
Currently, each radio button is a field called 'delete' with the name of the image
as the value. The name is passed to the delete function as #form.delete# ... works great!
However, when I change it to checkboxes, the value of #form.delete# comes through as multiple file names separated by a comma.
How can I take the value "c:/domains/path/images/filename.jpg, filename2.,jpg, filename3.jpg" and separate out all the filenames - basically trim off everything including the last /, then separate the remaining string by commas, removing spaces.
THEN I need to somehow loop the delete function, running through each of the filenames.