coldfusion - Duplicating and Renaming a file and storing name in Database -


i have register page asks information employee_number, user_name, user_pass, firstname, lastname, position, email, phone_extension, department, picture. once fill information out , hit register gets uploaded database.

is possible have create profile page specific user based on information in database?

for example, if registered have create davidbriertonprofile.cfm template profile.cfm , have add davidbriertonprofile.cfm in database can use name reference later. possible take template profile.cfm , rename based on there name , have added profiles/(therenameprofile).cfm

i have been playing cffile in order create path need behind scenes selecting template file user never sees of this.

<cffile       action       = "upload"       file         = "#expandpath("/webapps/dash/profiles/profile.cfm")#"      destination  = "#expandpath("/webapps/dash/profiles/")#"       nameconflict = "makeunique"       result       = "myfile"     />  

there 2 primary options

create static file coldfusion template...

<cfsavecontent variable="filecontent">     <cfinclude template="profile.cfm" /> </cfsavecontent> <cffile action="write" file="profiles/#firstnamelastname#profile.html" output="#filecontent#" /> <!--- looks "nameconflict" option available upload action have deal ---> 

create file setting userid , including profile.cfm

<cffile action="write"     file="profiles/#firstnamelastname#.cfm"     output="<cfset userid ='#userid' /><cfinclude template='../profile.cfm' />" /> 

some other options include

  • save name of unique cfm file create (ex: davidsmith12profile) don't create , instead use onmissingtemplate function in application.cfc take name supplied , perform database lookup , show profile result

  • peform url rewrite on webserver transform request paths of format /profiles/(.+) /profile.cfm?filename={\1} , database lookup filename directly in profile.cfm

enjoy


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -