Is form updating ...
<cfif request.BusinessError EQ "" AND isDefined("form.updatebusiness")>
<cfset bus.bus_ID = business.SetBusiness(argumentcollection=form)>
<cfset msg = form.bus_Name & " Updated Successfully.">
</cfif>
This returns the id of the business
SetBusiness cfc looks like this...
<cfquery name="rsInsert" > Do the form field data entry</cfquery>
<!--- upload image here --->
<cfif form.bus_Logo NEQ "">
<cfset img = uploadImage(#bus_ID#,#form.bus_Logo#)></cfif>
You can see here that the file field is getting passed to yet ANOTHER CFC and uploadImage looks like this...
<cffunction name="uploadImage" hint="send me the upload file and bus ID and I will insert it.">
<cfargument name="bus_ID" required="yes" hint="business ID you goof! numeric of course :)">
<cfargument name="fileLoc" required="yes" hint="send me the file field.">
<!--- Search for existing business folder --->
<cfdirectory action="list" directory="#request.folderStruct#memberLogos" name="findFolder" filter="#bus_ID#">
<!-- If no folder exists, create one --->
<cfif findFolder.recordcount IS 0>
<cflock name="crDir" timeout="30" type="exclusive">
<cfdirectory action="create" directory="#request.folderStruct#memberLogos/#bus_ID#">
</cflock>
</cfif>
<!--- Insert uploaded file--->
<cflock name="crDir" timeout="30" type="exclusive">
<cffile action="upload" filefield="fileLoc" destination="#request.folderStruct#memberLogos/#bus_ID#/" nameconflict="overwrite" accept="image/*">
</cflock>
<cfset fileName = cffile.clientFile>
<cfquery name="update_image">Update the business record with the 'filename'
</cfquery>
</cffunction>
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE