In the intranet I am developing, the user can add a new document to the web. he has to go to a page where he clicks on the the department name , a form to add the document to that deparment comes up. this form consist of document name , description, a browse button , upload document button and department name field. since it is intranet, the department name of the user is known when he logged on and stored in session variable and shown as such in the department name field. he then upload the document to the directory on the server. this directory is further divided into sub directories which are the department names. so that document should be uploaded to the selected department (sub directory). when he is finished the web page should show the department name as the title and list of all the documents of that deparment. but it is not happening. the documents are ending up in the main directory and not the sub-directories (departments) and the list also shows the list of the sub directories (departments). it is not considering department e. PLEASE help. here is the code
========================================================
ADD NEW DOCUMENT FORM CODE
========================================================
<!---CFincludes header, Css style sheet and Side Menu--->
<cfinclude template="/Header.cfm">
<SCRIPT LANGUAGE="JavaScript"><!--
function submitforms(){
Upload.submit()
Attachment.submit()
}
//--></SCRIPT>
<body>
<cfform action="Upload.cfm" method="POST" enablecab="No" name="Upload" enctype="multipart/form-data" preservedata="Yes">
<table border="0">
<tr>
<th colspan="2">Add a New Department Document</th>
</tr>
<tr>
<td>Document Name</td>
<td>
<cfinput type="text" name="wpTitle">
</td>
</tr>
<tr>
<td>Department</td>
<td>
<input type="hidden" name="wpdept">
<cfoutput>#Session.Auth.Dept#</cfoutput></td>
</tr>
<tr>
<td></td>
<td>
<input type="hidden" name="wptype" value="7">
</td>
</tr>
<tr>
<td>Description</td>
<td>
<cfinput type="text" name="wpDescription">
</td>
</tr>
<tr>
<td></td>
<td><input type="hidden" name="wpDateCreated" value="#CreateODBCDateTime(Now())#"</td>
</tr>
<tr>
<td colspan="2">
<tr>
<td colspan="2">
<cfform action="upload.cfm" method="POST" enablecab="No" name="Attachment" enctype="multipart/form-data" preservedata="Yes">
<input type="file" name="wpAttachment" size="40" value="#wpID#"
accept="application/msword,application/msexcel,application/pdf,text/html,application/rtf" class="button2">
<tr>
<td colspan="2"></td>
</cfform>
<tr>
<td colspan="2"></tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit Forms" onClick="submitforms()">
</td>
</tr>
</table>
</cfform>
</body>
<!---CFInclude Footer--->
<cfinclude template="/footer.cfm">
==================================================
UPLOAD.cfm CODE
===================================================
<cfinclude template="/Header.cfm">
<!---CF Directory to department directory--->
<cfdirectory action="LIST" directory="d:\Intranet online documents\#wpdept#" name="documents" filter="">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<CFFILE ACTION="UPLOAD" FILEFIELD="wpAttachment"
DESTINATION="D:\Intranet Online Documents\#wpdept#\"
NAMECONFLICT="MAKEUNIQUE"
ACCEPT="application/msword,application/msexcel,application/pdf,text/html,application/rtf">
<cfform action="DeleteDoc.cfm" method="post">
<input type="submit" name="Delete" value="Delete">
<table width="75%" border="1">
<tr>
<td colspan="4"></td>
</tr>
<cfoutput>
<th colspan="4"><b><font size="4">#wpdept# Documents</font></b></th>
</cfoutput>
<tr>
<td width="2%"><input type="checkbox" onClick="if (this.checked) CheckAll(this.form); else ClearAll(this.form)"></td>
<td > </td>
<td><div align="center"><font size="4"><b><font size="3">Name</font></b></font></div></td>
<td width="9%">
<div align="center"><font size="3"><b>Document Size</b></font></div>
</td>
</tr>
<cfoutput query="Documents">
<CFIF #name# Contains ".doc">
<cfset image = "MSword.gif">
<CFelseIF #name# Contains ".dot">
<cfset image = "MSword.gif">
<cfelseif #name# Contains ".xls">
<cfset image = "MSExcel.gif">
<cfelseif #name# Contains ".ppt">
<cfset image = "MSPPT.gif">
<cfelseif #name# Contains ".pdf">
<cfset image = "pdf.gif">
<cfelseif #name# Contains ".rtf">
<cfset image = "rtf.gif">
<cfelseif #name# Contains ".mdb">
<cfset image = "MSAccess.gif">
<cfelseif #name# Contains ".htm">
<cfset image = "Html.gif">
<CFelse>
<cfset image = "file.gif">
</CFIF>
<tr>
<cfif Name is not "." and Name is not "..">
<td width="2%"><INPUT type="checkbox" name="dID" ></td>
<td><img src="/cfimages/#image#"></td>
<td width="89%"><a href="file://uwmspintranet/Intranet online documents/#wpdept#/#name#" target="_blank">#name#</a></td>
<td width="9%">#size#</td>
</cfif>
</CFOUTPUT>
</tr>
</table>
</cfform>
</body>
</html>
<cfinclude template="/footer.cfm">
========================================================
ADD NEW DOCUMENT FORM CODE
========================================================
<!---CFincludes header, Css style sheet and Side Menu--->
<cfinclude template="/Header.cfm">
<SCRIPT LANGUAGE="JavaScript"><!--
function submitforms(){
Upload.submit()
Attachment.submit()
}
//--></SCRIPT>
<body>
<cfform action="Upload.cfm" method="POST" enablecab="No" name="Upload" enctype="multipart/form-data" preservedata="Yes">
<table border="0">
<tr>
<th colspan="2">Add a New Department Document</th>
</tr>
<tr>
<td>Document Name</td>
<td>
<cfinput type="text" name="wpTitle">
</td>
</tr>
<tr>
<td>Department</td>
<td>
<input type="hidden" name="wpdept">
<cfoutput>#Session.Auth.Dept#</cfoutput></td>
</tr>
<tr>
<td></td>
<td>
<input type="hidden" name="wptype" value="7">
</td>
</tr>
<tr>
<td>Description</td>
<td>
<cfinput type="text" name="wpDescription">
</td>
</tr>
<tr>
<td></td>
<td><input type="hidden" name="wpDateCreated" value="#CreateODBCDateTime(Now())#"</td>
</tr>
<tr>
<td colspan="2">
<tr>
<td colspan="2">
<cfform action="upload.cfm" method="POST" enablecab="No" name="Attachment" enctype="multipart/form-data" preservedata="Yes">
<input type="file" name="wpAttachment" size="40" value="#wpID#"
accept="application/msword,application/msexcel,application/pdf,text/html,application/rtf" class="button2">
<tr>
<td colspan="2"></td>
</cfform>
<tr>
<td colspan="2"></tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit Forms" onClick="submitforms()">
</td>
</tr>
</table>
</cfform>
</body>
<!---CFInclude Footer--->
<cfinclude template="/footer.cfm">
==================================================
UPLOAD.cfm CODE
===================================================
<cfinclude template="/Header.cfm">
<!---CF Directory to department directory--->
<cfdirectory action="LIST" directory="d:\Intranet online documents\#wpdept#" name="documents" filter="">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<CFFILE ACTION="UPLOAD" FILEFIELD="wpAttachment"
DESTINATION="D:\Intranet Online Documents\#wpdept#\"
NAMECONFLICT="MAKEUNIQUE"
ACCEPT="application/msword,application/msexcel,application/pdf,text/html,application/rtf">
<cfform action="DeleteDoc.cfm" method="post">
<input type="submit" name="Delete" value="Delete">
<table width="75%" border="1">
<tr>
<td colspan="4"></td>
</tr>
<cfoutput>
<th colspan="4"><b><font size="4">#wpdept# Documents</font></b></th>
</cfoutput>
<tr>
<td width="2%"><input type="checkbox" onClick="if (this.checked) CheckAll(this.form); else ClearAll(this.form)"></td>
<td > </td>
<td><div align="center"><font size="4"><b><font size="3">Name</font></b></font></div></td>
<td width="9%">
<div align="center"><font size="3"><b>Document Size</b></font></div>
</td>
</tr>
<cfoutput query="Documents">
<CFIF #name# Contains ".doc">
<cfset image = "MSword.gif">
<CFelseIF #name# Contains ".dot">
<cfset image = "MSword.gif">
<cfelseif #name# Contains ".xls">
<cfset image = "MSExcel.gif">
<cfelseif #name# Contains ".ppt">
<cfset image = "MSPPT.gif">
<cfelseif #name# Contains ".pdf">
<cfset image = "pdf.gif">
<cfelseif #name# Contains ".rtf">
<cfset image = "rtf.gif">
<cfelseif #name# Contains ".mdb">
<cfset image = "MSAccess.gif">
<cfelseif #name# Contains ".htm">
<cfset image = "Html.gif">
<CFelse>
<cfset image = "file.gif">
</CFIF>
<tr>
<cfif Name is not "." and Name is not "..">
<td width="2%"><INPUT type="checkbox" name="dID" ></td>
<td><img src="/cfimages/#image#"></td>
<td width="89%"><a href="file://uwmspintranet/Intranet online documents/#wpdept#/#name#" target="_blank">#name#</a></td>
<td width="9%">#size#</td>
</cfif>
</CFOUTPUT>
</tr>
</table>
</cfform>
</body>
</html>
<cfinclude template="/footer.cfm">