badboypolar

Junior Member
Apr 17, 2003
21
0
0
Need help with this. I am trying to have one script upload a file then add a record to the database and one of the calls is a variable. I want the formname (which is actually filename) to be called from the uploaded file. Here is the code. Any help would be GREATLY appreicated. Also I don't have money to buy a product so please don't suggest that.
First the upload doesn't work. The MBRequest(file1).Save isn't supported in this manner. I know you can use .save to upload a file.
second I can't figure out if the call for FORMNAME would work.

<%@ LANGUAGE=VBSCRIPT %>
<%Option Explicit%>

<%
Dim DB_CONNECTIONSTRING
Dim objRecordset
Dim Added
Dim ServerPath
Dim strPath
Dim MBRequest
%>

<!--#include file="adovbs.inc"-->

<%
DB_CONNECTIONSTRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("FORMS.mdb") & ";"

Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.Open "Forms", DB_CONNECTIONSTRING, adOpenStatic, adLockPessimistic, adCmdTable

If Request.Form("btnAdd") = "Add Form" Then

Serverpath = "c:\inetpub\wwwroot\forms"

strPath = Serverpath & "\" & Request.Form("selLocation")

set MBRequest = GetObject( strPath )

' If MBRequest ("submit") = "upload" then
' Response.Write "You Uploaded: " & MBRequest("File1").Path & MBRequest("File1").FileName & "
" & vbNewLine
' Response.Write "The Extension Is: " & MBRequest("File1").Extension & "
" & vbNewLine
' Response.Write "The MIME/ContentType Is: " & MBRequest("File1").ContentType

' -- Save the uploaded file to the directory this ASP script resides in --
MBRequest("File1").Save

' -- Next part --
objRecordset.AddNew

'-- Add records to database from form --

objRecordset.Fields("DATEOFENTRY") = Request.Form("txtDateOfEntry")
objRecordset.Fields("FORMTITLE") = Request.Form("txtFormTitle")
objRecordset.Fields("FORMNAME") = MBRequest("File1").FileName & MBRequest("File1").Extension HERE IS MY CALL.
objRecordset.Fields("FILETYPE") = Request.Form("selFileType")
objRecordset.Fields("LOCATION") = Request.Form("selLocation")
objRecordset.Fields("COMMENTS") = Request.Form("txtComments")
objRecordset.Fields("ENTEREDBY") = Request.Form("txtEnteredBy")


objRecordset.Update

Added = "True"

' End

End If

objRecordset.Close
Set objRecordset = Nothing
set MBRequest = Nothing

If Added = "True" Then
Response.Redirect ("formlist5.asp")
End If

%>

<html><title>Add Form</title>
<body>
<center>
<font size="4"><strong>Add New Form or Document</strong></font>

ALL Fields <strong>MUST</strong> be filled out.
<form method="post" action="AddForm.asp" enctype="multipart/form-data">

<table border="1" cellpadding="2" cellspacing="1" width="75%">
<tr>
<td><strong>Form/Document Title: </strong></td>
<td><input type="text" name="txtFormTitle" size="35"></td>
</tr>
<tr>
<td><strong>File : </strong></td>
<td><input type="file" name="File1" size="35"></td>
</tr>
<tr>
<td><strong>File Type : </strong></td>
<td><select name="selFileType">
<option value="Word">Word</option>
<option value="Excel">Excel</option>
<option value="Web">Web Based</option>
<option value="PDF">Acrobat Reader</option>
<option value="PowerPoint">PowerPoint</option>
<option value="Publisher">Publisher</option>
<option value="Other">Other</option>
</select></td>
</tr>
<tr>
<td> <strong>Location</strong> file will reside (who will have access
to view said file): </td>
<td> <select name="selLocation">
<option value="Employee">Employee</option>
<option value="HR">HR</option>
<option value="Training">Training</option>
<option value="Provider">Provider</option>
<option value="Managers">Managers</option>
<option value="Printing">Printing</option>
</select></td>
</tr>
<tr>
<td><strong>Comments :</strong></td>
<td><textarea name="txtComments" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="hidden" name="txtEnteredBy" size="35" value="<% = request.servervariables("logon_user") %>">
<input name="txtDateOfEntry" type="hidden" value="<% = Date %>" size="10" maxlength="10"></td>
</tr>
</table>

<p>

<input type="submit" name="btnAdd" value="Add Form"><input type="Reset" name="btnReset" value="Clear">

</form>

</center>

</body>
</html>
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |