Question
Deleting Multiple Images
I am New guy in CF and i just wanna just multiple images from
a folder and database. I was working with list but came to an
errorus Error: like this:
Invalid list index 0.
In function ListDeleteAt(list, index [, delimiters]), the value of index, 0, is not a valid as the first argument (this list has 4 elements). Valid indexes are in the range 1 through the number of elements in the list.
The error occurred in C:\Inetpub\wwwroot\admin\activities\index.cfm: line 547
Called from C:\Inetpub\wwwroot\admin\activities\index.cfm: line 519
Called from C:\Inetpub\wwwroot\admin\activities\index.cfm: line 514
Called from C:\Inetpub\wwwroot\admin\activities\index.cfm: line 1
545 : <Cfset filename = #form.attachments#>
546 :
547 : <cfset filelist = listdeleteat(form.filelist, ListFind(form.filelist, filename))>
548 : <cfset fileidlist = listdeleteat(form.fileidlist, ListFind(form.filelist, filename))>
549 : <cfset filesizelist = listdeleteat(form.filesizelist, ListFind(form.filelist, filename))>
Here is the source code what i see in the browser and the query i am executing after that:
<input type="hidden" name="filelist" value="bentleyarnageredlabel04_1024x768.jpg,bentleyarnageredlabel03_1024x768.jpg,bentley03_1024x768.jpg,bentley01_1024x768.jpg">
<input type="hidden" name="fileidlist" value="6,7,8,9">
<input type="hidden" name="filesizelist" value="88.65,145.786,136.332,141.308">
<Cfif isdefined("form.DeleteAttachment")>
<Cfset filename = #form.attachments#>
<cfset filelist = listdeleteat(form.filelist, ListFind(form.filelist, filename))>
<cfset fileidlist = listdeleteat(form.fileidlist, ListFind(form.filelist, filename))>
<cfset filesizelist = listdeleteat(form.filesizelist, ListFind(form.filelist, filename))>
<cfset timestamp = #form.timestamp#>
<cffile action="DELETE" file="#path##filename#">
<CFQUERY NAME="RemoveFile" datasource="#request.dsn#">
DELETE From Activities_attachments
WHERE Attach_FileName IN ('#filename#')
</CFQUERY>
</CFIF>
can anybody plz guide me inthis?
Thanks
Invalid list index 0.
In function ListDeleteAt(list, index [, delimiters]), the value of index, 0, is not a valid as the first argument (this list has 4 elements). Valid indexes are in the range 1 through the number of elements in the list.
The error occurred in C:\Inetpub\wwwroot\admin\activities\index.cfm: line 547
Called from C:\Inetpub\wwwroot\admin\activities\index.cfm: line 519
Called from C:\Inetpub\wwwroot\admin\activities\index.cfm: line 514
Called from C:\Inetpub\wwwroot\admin\activities\index.cfm: line 1
545 : <Cfset filename = #form.attachments#>
546 :
547 : <cfset filelist = listdeleteat(form.filelist, ListFind(form.filelist, filename))>
548 : <cfset fileidlist = listdeleteat(form.fileidlist, ListFind(form.filelist, filename))>
549 : <cfset filesizelist = listdeleteat(form.filesizelist, ListFind(form.filelist, filename))>
Here is the source code what i see in the browser and the query i am executing after that:
<input type="hidden" name="filelist" value="bentleyarnageredlabel04_1024x768.jpg,bentleyarnageredlabel03_1024x768.jpg,bentley03_1024x768.jpg,bentley01_1024x768.jpg">
<input type="hidden" name="fileidlist" value="6,7,8,9">
<input type="hidden" name="filesizelist" value="88.65,145.786,136.332,141.308">
<Cfif isdefined("form.DeleteAttachment")>
<Cfset filename = #form.attachments#>
<cfset filelist = listdeleteat(form.filelist, ListFind(form.filelist, filename))>
<cfset fileidlist = listdeleteat(form.fileidlist, ListFind(form.filelist, filename))>
<cfset filesizelist = listdeleteat(form.filesizelist, ListFind(form.filelist, filename))>
<cfset timestamp = #form.timestamp#>
<cffile action="DELETE" file="#path##filename#">
<CFQUERY NAME="RemoveFile" datasource="#request.dsn#">
DELETE From Activities_attachments
WHERE Attach_FileName IN ('#filename#')
</CFQUERY>
</CFIF>
can anybody plz guide me inthis?
Thanks
