minority
07-20-2005, 08:01 AM
this one got me stumped. I need some one with a brain!!
ok what i am trying to do.
Firstly i have this upload document which hass a drop down populated by Document_type table what i want is when they select something from here if it has a Sub category then populate the other box with the relevent sub categories if possible.
Yes it is a yes/no column buntine lol.
the code i have so far is bellow i aint a clue what to do to get this to work.
<!--#include file="../testsecurity2.asp"-->
<% levelcheck(2)%>
<%
'Sample file Field-SaveAs.asp
'Store extra upload info to a database
' and file contents to the disk
Server.ScriptTimeout = 5000
'Create upload form
'Using Huge-ASP file upload
'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
'Using Pure-ASP file upload
Dim Form: Set Form = New ASPForm %><!--#INCLUDE file="_upload.asp"--><%
Server.ScriptTimeout = 1000
Form.SizeLimit = &HA00000'10MB
'was the Form successfully received?
Const fsCompletted = 0
If Form.State = fsCompletted Then 'Completted
'Create destination path+filename for the source file.
Dim DestinationPath, DestinationFileName
DestinationPath = "C:\Intranet\qms\upload\"
DestinationFileName = DestinationPath & Form("SourceFile").FileName
'Open recordset to store uploaded data
Dim RS: Set RS = OpenUploadRS
'Store extra info about upload to database
RS.AddNew
RS("Date") = Now()
RS("Doc_Name") = Form("SourceFile").FileName
RS("Version") = Form.Texts.Item("Version")
RS("Dept_ID") = Form.Texts.Item("Dept")
RS("Doc_Type_ID") = Form.Texts.Item("DocType")
RS("From") = Form("SourceFile").FilePath
RS("Link") = DestinationFileName
RS("DataSize") = Form("SourceFile").Length
'...
RS.Update
Response.write "<br>Source file names:"
Dim Field: For Each Field in Form.Files.Items
Response.write "<br> " & Field.FileName
Next
'{b}Save file to the destination
Form("SourceFile").SaveAs DestinationFileName
'{/b}
response.write "<Font color=green><br>SourceFile was saved as " & DestinationFileName
response.write "<br>See ListFiles table in " & Server.MapPath("upload.mdb") & " database.</Font>"
Response.Redirect("../index.asp")
ElseIf Form.State > 10 then
Const fsSizeLimit = &HD
Select case Form.State
case fsSizeLimit: response.write "<br><Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font><br>"
case else response.write "<br><Font Color=red>Some form error.</Font><br>"
end Select
End If'Form.State = 0 then
Function OpenUploadRS()
Dim RS : Set RS = CreateObject("ADODB.Recordset")
'Open dynamic recordset, table Upload
RS.Open "Document", GetConnection, 2, 2
Set OpenUploadRS = RS
end Function
Function GetConnection()
dim Conn: Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.open "Data Source=C:\Intranet\qms\database\qrm.mdb;User Id=admin;Password=;"
set GetConnection = Conn
end function
%>
</head> <form method=post ENCTYPE="multipart/form-data">
<body onLoad="MM_preloadImages('/images/nav/home_r.gif','/images/nav/applications_r.gif','/images/nav/products_r.gif','/images/nav/software_r.gif','/images/nav/support_r.gif','/images/nav/developments_r.gif','/images/nav/investor_r.gif','/images/nav/locations_r.gif')">
<!--#include file="../../include/docmenu.asp"--></td>
<td width="721">
<!-- PAGE CONTENT START -->
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top"> <table width ="100%">
<tr>
<td width = "3%"></td>
<td width = "47%"><b>
<h1><u>Intranet Administration</u></h1>
</b></td>
<td width = "50%"></td>
</tr>
</table>
<table width ="100%">
<tr>
<td width = "5%"></td>
<td width = "44%"><b>
<h2>Delete Document</h2>
</b></td>
<td width = "51%"></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width ="100%">
<tr>
<td width ="10%"></td>
<td width ="15%"> File to upload</td>
<td width = "30%"><input type="file" name="SourceFile"></td>
</tr>
<tr>
<td>
<tr>
<td width ="10%"></td>
<td width ="15%">Version</td>
<td width ="30%"><input ="text" name="Version"></td>
</tr>
<tr>
<td width ="10%"></td>
<td width ="15%">Department
<% Dim strCon
Dim strSQLDocType, strSQLDept
Set rsDocType = Server.CreateObject("ADODB.Recordset")
Set rsDept = Server.CreateObject("ADODB.Recordset")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Intranet\qms\database\qrm.mdb;User Id=admin;Password=;"
strSQLDocType = "SELECT Doc_Type_ID, Type_Name FROM Document_Type"
strSQLDept = "SELECT Dept_ID, Dept_Name FROM Department"
rsDocType.Open strSQLDocType, strCon
rsDept.Open strSQLDept, strCon
%></td>
<td width ="30%"> <select name="Dept">
<%
Do until rsDept.EOF
Response.Write("<option value=""" & rsDept("Dept_ID") & """ > " & rsDept("Dept_Name") & "</option>" & vbCrLf)
rsDept.MoveNext()
loop
%>
</select> <%
rsDept.Close
Set rsDept = Nothing
%></td>
</tr>
<tr>
<td width ="10%"></td>
<td width ="15%">File Type</td>
<td width ="30%"> <select name="DocType">
<%
Do until rsDocType.EOF
Response.Write("<option value=""" & rsDocType("Doc_Type_ID") & """ > " & rsDocType("Type_Name") & "</option>" & vbCrLf)
rsDocType.MoveNext()
loop
%>
</select> <%
rsDocType.Close
Set rsDocType = Nothing
Set adoCon = Nothing
%></td>
</tr>
</table><br>
<table width ="85%">
<tr>
<td width="25%"></td>
<td width ="20%"><input type="submit" Name="Action" value="Upload File"></td>
<td width ="5%"></td>
<td width ="30%"><input type="submit" Name="reset" value="Reset"> </td>
</tr>
</table></form></td>
</tr>
</table>
<!-- PAGE CONTENT END -->
</td>
<td width="17">
<!-- RIGHT MENU START -->
<!-- RIGHT MENU END -->
</td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#0c66aa"></td>
<td> </td>
<td> </td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#0c66aa"></td>
<td align="center" class="copyright"></td>
<td></td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#0c66aa"> </td>
<td> </td>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="topTile" >
<tr>
<td width="145" align="left" valign="top" class="bodyCopy"><img src="../../Images/logo1bottom.GIF" alt="Sondex" width="145" height="10" border="0"></td>
<td width="344" align="left" valign="top" class="bodyCopy"><img src="../../Images/logo3bottom.GIF" alt="" width="344" height="10" border="0"></a></td>
<td width="408" align="left" valign="top"><img src="../../Images/logoendbottom.GIF" alt="" width="344" height="10" border="0"></td>
<td width="100%" align="left" valign="top"><img src="../../Images/logoend_Revisedbottom.GIF" alt="" width="104" height="10" border="0"></td>
</tr>
</table>
</body>
</html>
Any help would be greatful especially since i need pretty much guided through it.
ok what i am trying to do.
Firstly i have this upload document which hass a drop down populated by Document_type table what i want is when they select something from here if it has a Sub category then populate the other box with the relevent sub categories if possible.
Yes it is a yes/no column buntine lol.
the code i have so far is bellow i aint a clue what to do to get this to work.
<!--#include file="../testsecurity2.asp"-->
<% levelcheck(2)%>
<%
'Sample file Field-SaveAs.asp
'Store extra upload info to a database
' and file contents to the disk
Server.ScriptTimeout = 5000
'Create upload form
'Using Huge-ASP file upload
'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
'Using Pure-ASP file upload
Dim Form: Set Form = New ASPForm %><!--#INCLUDE file="_upload.asp"--><%
Server.ScriptTimeout = 1000
Form.SizeLimit = &HA00000'10MB
'was the Form successfully received?
Const fsCompletted = 0
If Form.State = fsCompletted Then 'Completted
'Create destination path+filename for the source file.
Dim DestinationPath, DestinationFileName
DestinationPath = "C:\Intranet\qms\upload\"
DestinationFileName = DestinationPath & Form("SourceFile").FileName
'Open recordset to store uploaded data
Dim RS: Set RS = OpenUploadRS
'Store extra info about upload to database
RS.AddNew
RS("Date") = Now()
RS("Doc_Name") = Form("SourceFile").FileName
RS("Version") = Form.Texts.Item("Version")
RS("Dept_ID") = Form.Texts.Item("Dept")
RS("Doc_Type_ID") = Form.Texts.Item("DocType")
RS("From") = Form("SourceFile").FilePath
RS("Link") = DestinationFileName
RS("DataSize") = Form("SourceFile").Length
'...
RS.Update
Response.write "<br>Source file names:"
Dim Field: For Each Field in Form.Files.Items
Response.write "<br> " & Field.FileName
Next
'{b}Save file to the destination
Form("SourceFile").SaveAs DestinationFileName
'{/b}
response.write "<Font color=green><br>SourceFile was saved as " & DestinationFileName
response.write "<br>See ListFiles table in " & Server.MapPath("upload.mdb") & " database.</Font>"
Response.Redirect("../index.asp")
ElseIf Form.State > 10 then
Const fsSizeLimit = &HD
Select case Form.State
case fsSizeLimit: response.write "<br><Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font><br>"
case else response.write "<br><Font Color=red>Some form error.</Font><br>"
end Select
End If'Form.State = 0 then
Function OpenUploadRS()
Dim RS : Set RS = CreateObject("ADODB.Recordset")
'Open dynamic recordset, table Upload
RS.Open "Document", GetConnection, 2, 2
Set OpenUploadRS = RS
end Function
Function GetConnection()
dim Conn: Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.open "Data Source=C:\Intranet\qms\database\qrm.mdb;User Id=admin;Password=;"
set GetConnection = Conn
end function
%>
</head> <form method=post ENCTYPE="multipart/form-data">
<body onLoad="MM_preloadImages('/images/nav/home_r.gif','/images/nav/applications_r.gif','/images/nav/products_r.gif','/images/nav/software_r.gif','/images/nav/support_r.gif','/images/nav/developments_r.gif','/images/nav/investor_r.gif','/images/nav/locations_r.gif')">
<!--#include file="../../include/docmenu.asp"--></td>
<td width="721">
<!-- PAGE CONTENT START -->
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top"> <table width ="100%">
<tr>
<td width = "3%"></td>
<td width = "47%"><b>
<h1><u>Intranet Administration</u></h1>
</b></td>
<td width = "50%"></td>
</tr>
</table>
<table width ="100%">
<tr>
<td width = "5%"></td>
<td width = "44%"><b>
<h2>Delete Document</h2>
</b></td>
<td width = "51%"></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width ="100%">
<tr>
<td width ="10%"></td>
<td width ="15%"> File to upload</td>
<td width = "30%"><input type="file" name="SourceFile"></td>
</tr>
<tr>
<td>
<tr>
<td width ="10%"></td>
<td width ="15%">Version</td>
<td width ="30%"><input ="text" name="Version"></td>
</tr>
<tr>
<td width ="10%"></td>
<td width ="15%">Department
<% Dim strCon
Dim strSQLDocType, strSQLDept
Set rsDocType = Server.CreateObject("ADODB.Recordset")
Set rsDept = Server.CreateObject("ADODB.Recordset")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Intranet\qms\database\qrm.mdb;User Id=admin;Password=;"
strSQLDocType = "SELECT Doc_Type_ID, Type_Name FROM Document_Type"
strSQLDept = "SELECT Dept_ID, Dept_Name FROM Department"
rsDocType.Open strSQLDocType, strCon
rsDept.Open strSQLDept, strCon
%></td>
<td width ="30%"> <select name="Dept">
<%
Do until rsDept.EOF
Response.Write("<option value=""" & rsDept("Dept_ID") & """ > " & rsDept("Dept_Name") & "</option>" & vbCrLf)
rsDept.MoveNext()
loop
%>
</select> <%
rsDept.Close
Set rsDept = Nothing
%></td>
</tr>
<tr>
<td width ="10%"></td>
<td width ="15%">File Type</td>
<td width ="30%"> <select name="DocType">
<%
Do until rsDocType.EOF
Response.Write("<option value=""" & rsDocType("Doc_Type_ID") & """ > " & rsDocType("Type_Name") & "</option>" & vbCrLf)
rsDocType.MoveNext()
loop
%>
</select> <%
rsDocType.Close
Set rsDocType = Nothing
Set adoCon = Nothing
%></td>
</tr>
</table><br>
<table width ="85%">
<tr>
<td width="25%"></td>
<td width ="20%"><input type="submit" Name="Action" value="Upload File"></td>
<td width ="5%"></td>
<td width ="30%"><input type="submit" Name="reset" value="Reset"> </td>
</tr>
</table></form></td>
</tr>
</table>
<!-- PAGE CONTENT END -->
</td>
<td width="17">
<!-- RIGHT MENU START -->
<!-- RIGHT MENU END -->
</td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#0c66aa"></td>
<td> </td>
<td> </td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#0c66aa"></td>
<td align="center" class="copyright"></td>
<td></td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#0c66aa"> </td>
<td> </td>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="topTile" >
<tr>
<td width="145" align="left" valign="top" class="bodyCopy"><img src="../../Images/logo1bottom.GIF" alt="Sondex" width="145" height="10" border="0"></td>
<td width="344" align="left" valign="top" class="bodyCopy"><img src="../../Images/logo3bottom.GIF" alt="" width="344" height="10" border="0"></a></td>
<td width="408" align="left" valign="top"><img src="../../Images/logoendbottom.GIF" alt="" width="344" height="10" border="0"></td>
<td width="100%" align="left" valign="top"><img src="../../Images/logoend_Revisedbottom.GIF" alt="" width="104" height="10" border="0"></td>
</tr>
</table>
</body>
</html>
Any help would be greatful especially since i need pretty much guided through it.