I am using the following code to modify or overwrite an existing file on the server, but the code does not when I click the submit button.
Any Ideas, Anyone?
CODE:
<!--- Modify Small Image files --->
<cfif #FORM.hsmFileName# NEQ '' >
<cffile
action="upload"
filefield="smImageFil"
destination="D:\ attributes="Normal"
nameconflict="overwrite">
<cfset oldPathAndName = #FORM.hsmFileName#>
<cfset arrPathAndName = ListToArray(oldPathAndName, '\')>
<cfset fileName = arrPathAndName[ArrayLen(arrPathAndName)]>
<!--- Rename the file to the product number --->
<cfset name1 = "D:\ & #filename#>
<cfset name2 = "D:\ & #form.prod_number# & "_" & "sm" & "." & "JPG">
<cffile action="rename"
source = "#name1#"
destination = "#name2#"
attributes = "Normal">
</cfif>
<!--- Form --->
<!--- Small Product Image File --->
<form name="admin_products" action="index.cfm?fuseaction=dsp_admin_products&subaction=mod&processAction=submitMod" method="post" enctype="multipart/form-data" >
<table>
<tr>
<td>
Small Product Image <font color="red"><b>*</b></font> : </td>
<td>
<input class="text" type="File" name="smImageFil" value="Browse..." size="30" tabindex="9" onBlur="return setValue(this, hsmFileName);">
<input type="hidden" name="hsmFileName" value=""> </td>
</tr>
<tr>
<td>
<input type="Submit" name="submit" value=" Modify " tabindex="7">
<input type="Reset" name="reset" value=" Reset ! " tabindex="8">
<input type="Hidden" name="processAction" value="submitMod">
</td>
</tr>
</table>
</form>
Any Ideas, Anyone?
CODE:
<!--- Modify Small Image files --->
<cfif #FORM.hsmFileName# NEQ '' >
<cffile
action="upload"
filefield="smImageFil"
destination="D:\ attributes="Normal"
nameconflict="overwrite">
<cfset oldPathAndName = #FORM.hsmFileName#>
<cfset arrPathAndName = ListToArray(oldPathAndName, '\')>
<cfset fileName = arrPathAndName[ArrayLen(arrPathAndName)]>
<!--- Rename the file to the product number --->
<cfset name1 = "D:\ & #filename#>
<cfset name2 = "D:\ & #form.prod_number# & "_" & "sm" & "." & "JPG">
<cffile action="rename"
source = "#name1#"
destination = "#name2#"
attributes = "Normal">
</cfif>
<!--- Form --->
<!--- Small Product Image File --->
<form name="admin_products" action="index.cfm?fuseaction=dsp_admin_products&subaction=mod&processAction=submitMod" method="post" enctype="multipart/form-data" >
<table>
<tr>
<td>
Small Product Image <font color="red"><b>*</b></font> : </td>
<td>
<input class="text" type="File" name="smImageFil" value="Browse..." size="30" tabindex="9" onBlur="return setValue(this, hsmFileName);">
<input type="hidden" name="hsmFileName" value=""> </td>
</tr>
<tr>
<td>
<input type="Submit" name="submit" value=" Modify " tabindex="7">
<input type="Reset" name="reset" value=" Reset ! " tabindex="8">
<input type="Hidden" name="processAction" value="submitMod">
</td>
</tr>
</table>
</form>