Well, I was trying to fix my page to send an e-mail to addresses in a database and somehow stopped my program from doing what it was originally doing! I've tried changing everything back, but still cannot get it to go back to submitting the form (saving the information to the database) and redirecting the user to an "incomplete forms" page (which lists all the forms that have yet to be completed).
o.Error: Failed due to the following error: Write to file failed.. Right now once I click the submit button it acts like it's processing the information for a few seconds and then it jus resets and clears the form. No error, no redirecting, no information saved.
I put a debugger in there to see what the program "was not" doing (response.write sFile) and found that it stops working at this line:
if (o.FileNameOf("ecpFilename")) <> "" then
But I've tried taking it out, checking the filename, EVERYTHING and it's right. If you can help, I would most certainly appreciate it, time is of the essence!
Thanks in advance!
postnew.asp
....missing code....
///user inserts a filename (along with other form info)///
Code:
<tr>
<td width="200" colspan = "4" align="right">
ECP Filename
</td>
<td width="550" colspan = "11">
<input type="file" name="ecpFilename" size="60"
<br>
<br>
(Please ensure the adobe filename
does not have spaces.
You may use underscores.)
</td>
</tr>
///upload file and send e-mail///
Code:
<%
set o = new clsUpload
if o.Exists("submitButton") then
'get client file name without path
sFileSplit = split(o.FileNameOf("ecpFilename"), "\")
sFile = sFileSplit(Ubound(sFileSplit))
'Upload filename
o.FileInputName = "ecpFilename"
o.FileFullPath = Server.MapPath(".") & "\ecpFiles\" & sFile
o.save
if (o.FileNameOf("ecpFilename")) <> "" then
'If not error redirect to complete message
if o.Error = "" then
response.write sFile
Dim pEcpNumber, pEcpTitle, pEcpFilename, pEcpOriginator, pEcpDateDistributed, pEcpDateDue, objCommand
Dim pEcpSMEcomplete, pEcpPMcomplete
pEcpNumber = o.ValueOf("ecpNumber")
pEcpTitle = o.ValueOf("ecpTitle")
pEcpFilename = sFile
pEcpOriginator = o.ValueOf("ecpOriginator")
pEcpOriginator = Session("UserFullName")
pEcpDateDistributed = CStr(date())
pEcpDateDue = CStr(o.ValueOf("ecpDateDue"))
pEcpSMEcomplete = ""
pEcpPMcomplete = ""
'Const adCmdText = &H0001
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = Connection
objCommand.Commandtext = "INSERT INTO ecpForms (ecpNumber, ecpTitle, ecpFilename, ecpOriginator, ecpDateDistributed, ecpDateDue, ecpSMEcomplete, ecpPMcomplete) VALUES ('" & pEcpNumber & "', '" & pEcpTitle & "', '" & pEcpFilename & "', '" & pEcpOriginator & "', '" & pEcpDateDistributed & "', '" & pEcpDateDue & "', '" & pEcpSMEcomplete & "', '" & pEcpPMcomplete & "')"
objCommand.CommandType = adCmdText
objCommand.Execute
Set objCommand = nothing
clsUpload.asp
....code....
Code:
Public Function Save()
if psFileFullPath <> "" and psFileInputName <> "" then
On error resume next
binData = o.BinaryDataOf(psFileInputName)
set rs = server.createobject("ADODB.RECORDSET")
rs.fields.append "FileName", 205, LenB(binData)
rs.open
rs.addnew
rs.fields(0).AppendChunk binData
if err.number = 0 then
set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.Write rs.fields("FileName").value
objStream.SaveToFile psFileFullPath, 2
objStream.close
set objStream = Nothing
ENd if
rs.close
set rs = nothing
psError = Err.Description
else
psError = "One or more required properties (FileFullPath and/or FileInputName) not set"
End If
End Function
Public Property Get Error()
Error = psError
End Property
T.B.
misskaos99@yahoo.com