Last active
December 15, 2015 18:09
-
-
Save youcoldfusion/5301601 to your computer and use it in GitHub Desktop.
Working with ColdFusion cffile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- We should use div's-:<div></div> instead of table ---> | |
<html> | |
<head> | |
<title> Employee Details</title> | |
</head> | |
<body> | |
<h2>Employee Details</h2> | |
<table> | |
<form action="aformAction.cfm" method="post" enctype="multipart/form-data"> | |
<tr> | |
<td>Employee ID:</td> | |
<td><input type="text" name="Emp_ID" size="4" maxlength="4"></td> | |
</tr> | |
<tr> | |
<td>First Name:</td> | |
<td><input type="Text" name="FirstName" size="35" maxlength="50"></td> | |
</tr> | |
<tr> | |
<td>Last Name:</td> | |
<td><input type="Text" name="LastName" size="35" maxlength="50"></td> | |
</tr> | |
<tr> | |
<td>Department Number:</td> | |
<td><input type="Text" name="Dept_ID" size="4" maxlength="4"></td> | |
</tr> | |
<tr> | |
<td>Start Date:</td> | |
<td><input type="Text" name="StartDate" size="16" maxlength="16"></td> | |
</tr> | |
<tr> | |
<td>Salary:</td> | |
<td><input type="Text" name="Salary" size="10" maxlength="10"></td> | |
</tr> | |
<tr> | |
<td>Contractor:</td> | |
<td><input type="checkbox" name="Contract" value="Yes" checked>Yes</td> | |
</tr> | |
<tr> | |
<td>Select a file:</td> | |
<td><input type="file" name="filecontent"></td> | |
</tr> | |
<tr> | |
<td> </td> | |
<td><input type="Submit" value="Submit"> <input type="Reset" | |
value="Clear Form"></td> | |
</tr> | |
</form> | |
<!--- end html form ---> | |
</table> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfdump var="#form#"> | |
<cffile action="upload" destination="DESTINATION PATH WHERE TO UPLOAD FILE=X" filefield="FILECONTENT" nameconflict="overwrite" > | |
<cffile action="read" file="X\FILENAME.txt/pdf/doc" variable="filecontentdisplay" > | |
<cfoutput> | |
<div> | |
<h2>Uploaded File Content</h2> | |
<div style="border:2px solid green"> | |
#filecontentdisplay# | |
</div> | |
</div> | |
</cfoutput> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Image upload ---> | |
<form action="contentUploadAction.cfm" name="contentUploadForm" enctype="multipart/form-data" method="post"> | |
<input type="file" name="fileContent"> | |
<input type="submit" value="Submit"> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Image upload ---> | |
<cfoutput> | |
<cffile action="upload" destination="E:\workspace\magic\uploadedfiles" filefield="fileContent" nameconflict="overwrite"> | |
<h2>Uploaded File Content</h2> | |
<div style="border:2px solid green;width:150px;height:150px"> | |
<img src="/uploadedfiles/#cffile.ClientFileName#.#cffile.ClientFileExt#" width="150" height="150"> | |
</div> | |
<div> | |
<a href="/contentUpload.cfm">Upload New Content</a> | |
</div> | |
</cfoutput> | |
<cfdump var="#cffile#"> | |
<cfdump var="#form#"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Profle Information</title> | |
</head> | |
<body> | |
<h2>Profle Infomation</h2> | |
<form action="contentWriteAction.cfm" method="Post"> | |
<div> | |
<label for="FileName">Resume Heading</label> | |
<input type="text" name="FileName" size="25" id="FileName"> | |
</div> | |
<div> | |
<label for="FileName">Paste your Resume information here:</label> | |
<textarea name="message"cols=45 rows=6></textarea> | |
<input type="submit" name="submit" value="Submit"> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Uploaded resume information</title> | |
</head> | |
<body> | |
<cffile action="write" file="E:\workspace\magic\uploadedfiles\#Form.FileName#.txt" output="#form.message#"> | |
<cffile action="read" file="E:\workspace\magic\uploadedfiles\#Form.FileName#.txt" variable="message"> | |
<h2>Your New Updated Resume</h2> | |
<div style="border:2px solid green;width:700px"> | |
<cfoutput>#message#</cfoutput> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment