I have created a coldfusion form & I am looking for a way to convert a input
type file field which loads a filepath to a URL address. All of the files that
my user will upload go to the same location, only a different pdf file name.
The file address is: N:\HR\Postings_And_Checklists\Postings\2009\12 CP Dec
2009\1209-04_Supervisor_Quote_Entry_12-7-09.pdf & I want to convert it to:
http://hr.companyname.com/Postings_And_Checklists/Postings/2009/12 CP Dec
2009/1209-04_Supervisor_Quote_Entry_12-7-09.pdf.
How can I do this? I have a very limited background in coldfusion/javascript
coding. I am using Coldfusion 8.
My code is below:
<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
<!---DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">--->
<cfparam name="FORM.PostDate" default="">
<cfparam name="FORM.Title" default="">
<cfparam name="FORM.Dept" default="">
<cfparam name="FORM.Hyperlink" default="">
<cfparam name="FORM.CloseDate" default="">
<cfparam name="FORM.ReqNumber" default="">
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
<cfquery datasource="Training">
INSERT INTO dbo.Job_Postings (PostDate, Title, Dept, Hyperlink, CloseDate,
ReqNumber)
VALUES (
<cfif IsDefined("FORM.PostDate") AND #FORM.PostDate# NEQ "">
<cfqueryparam value="#FORM.PostDate#" cfsqltype="cf_sql_clob"
maxlength="50">
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.Title") AND #FORM.Title# NEQ "">
<cfqueryparam value="#FORM.Title#" cfsqltype="cf_sql_clob" maxlength="100">
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.Dept") AND #FORM.Dept# NEQ "">
<cfqueryparam value="#FORM.Dept#" cfsqltype="cf_sql_clob" maxlength="100">
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.Hyperlink") AND #FORM.Hyperlink# NEQ "">
<cfqueryparam value="#FORM.Hyperlink#" cfsqltype="cf_sql_clob"
maxlength="150">
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.CloseDate") AND #FORM.CloseDate# NEQ "">
<cfqueryparam value="#FORM.CloseDate#" cfsqltype="cf_sql_clob"
maxlength="50">
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.ReqNumber") AND #FORM.ReqNumber# NEQ "">
<cfqueryparam value="#FORM.ReqNumber#" cfsqltype="cf_sql_clob"
maxlength="50">
<cfelse>
NULL
</cfif>
)
</cfquery>
<cflocation
url="http://hr.companyname.com/Postings_And_Checklists/DepartmentPostingsandChecklists/Job_Postings.cfm">
</cfif>
<cfquery name="MM_search" datasource="Training">
SELECT Dept From dbo.Job_Postings
</cfquery>
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<html>
<head>
<title>Add Job Posting to CIRC</title>
<style type="text/css">
<!--
.style2 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.style1 { font-size: 36px;
font-weight: bold;
}
#apDiv1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 9px;
top: 21px;
}
#apDiv2 {
position:absolute;
width:267px;
height:49px;
z-index:2;
left: 274px;
top: 62px;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.TimeFormat {
font-style: italic;
font-size: 14px;
}
.Example {
font-size: small;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<cfoutput>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<div id="apDiv1"><span class="style1"><img src="../../Large Logo.jpg"
alt="Logo" width="255" height="145" align="middle"></span></div>
<div id="apDiv2">
<h2 align="center"><strong>Add Job Posting <br>
to CIRC</strong></h2>
</div>
<cfform> <table width="583" border="0" align="left" cellpadding="2"
cellspacing="2">
<tr>
<th align="right">Posting Date</th>
<td><cfinput type="text" name="PostDate" id="PostDate"
value="#FORM.PostDate#" required="Yes" size="20">
<em>(MM/DD/YY)</em></td>
</tr>
<tr>
<th align="right">Position Title</th>
<td><cfinput type="Text" name="Title" value="#FORM.Title#"
required="Yes" size="80"></td>
</tr>
<tr>
<th align="right">Department</th>
<td><cfinput type="Text" name="Dept" value="#FORM.Dept#" required="Yes"
size="80"></td>
</tr>
<tr>
<th height="55" align="right" valign="top">Link to PDF Posting</th>
<td valign="top"><p>
<cfinput type="File" name="Hyperlink" id="Hyperlink"
value="#FORM.Hyperlink#" required="Yes" size="150">
</p></td>
</tr>
<tr>
<th align="right">Close Date</th>
<td><cfinput type="text" name="CloseDate" id="CloseDate"
value="#FORM.CloseDate#" required="Yes" size="20">
<em>(MM/DD/YY)</em></td>
</tr>
<tr>
<th align="right">Requisition Number<br></th>
<td><cfinput type="text" name="ReqNumber" id="ReqNumber"
value="#FORM.ReqNumber#" required="Yes" size="20"></td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="Action" id="Submit" value="Submit">
<input type="reset" value="Reset">
<input type="hidden" name="MM_InsertRecord2" value="form1">
</div>
<input type="hidden" name="MM_InsertRecord" value="form1"></td>
</tr>
</table>
<p> </p>
</form>
</cfform>
</cfoutput>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4935
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15