Question
cffile issue
well here is my problem..
i have a checkbox of items to delete, the items are displyed in the action page:
select image from table where
id = <cfqueryparam cf_sql_type="integer" value="#ListLen(form.del_ID,',')#">
ok this gets the file frfom the database..
then i check to see if the directory where the file is residing on my server exists..
if yes..
then i use this command
<cffile action=delete file=#queryname.image#>
and then
i do like this:
new query:
delete from mytable where ID in(#form.del_ID#)
but it deletes the record but does not delete the file from the server..
wel for the clarity of code here it is ;
<cfquery name="gb" datasource="#dsn#">
SELECT image
FROM mytable
WHERE ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ListLen(form.del_ID,',')#">
</cfquery>
<cfoutput query="gb">
<cfif directoryexists("#Application.file_path#banner")>
<cfset _file = "#Application.file_path#banner">
<cffile action="delete" file="#_file#/#gb.image#">
</cfif>
</cfoutput>
<CFQUERY DATASOURCE="#dsn#">
DELETE from mytable
WHERE ID IN (#form.del_ID#)
</CFQUERY>
#Application.file_path# shows my actual path and i have tested it, its working as
http://mysite.com/www/
i tries this also:
<cffile action="delete"
file="#expandpath("banner/#gb.image#")#">
due to this expandpath hange, i am able to delete the data from the database but the imag file remains in the folder, it still not gets deleted.
i have a checkbox of items to delete, the items are displyed in the action page:
select image from table where
id = <cfqueryparam cf_sql_type="integer" value="#ListLen(form.del_ID,',')#">
ok this gets the file frfom the database..
then i check to see if the directory where the file is residing on my server exists..
if yes..
then i use this command
<cffile action=delete file=#queryname.image#>
and then
i do like this:
new query:
delete from mytable where ID in(#form.del_ID#)
but it deletes the record but does not delete the file from the server..
wel for the clarity of code here it is ;
<cfquery name="gb" datasource="#dsn#">
SELECT image
FROM mytable
WHERE ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ListLen(form.del_ID,',')#">
</cfquery>
<cfoutput query="gb">
<cfif directoryexists("#Application.file_path#banner")>
<cfset _file = "#Application.file_path#banner">
<cffile action="delete" file="#_file#/#gb.image#">
</cfif>
</cfoutput>
<CFQUERY DATASOURCE="#dsn#">
DELETE from mytable
WHERE ID IN (#form.del_ID#)
</CFQUERY>
#Application.file_path# shows my actual path and i have tested it, its working as
http://mysite.com/www/
i tries this also:
<cffile action="delete"
file="#expandpath("banner/#gb.image#")#">
due to this expandpath hange, i am able to delete the data from the database but the imag file remains in the folder, it still not gets deleted.