Ok I still had to change a few things to get it to work, but it is "half way" working now. The message boxes are coming up now at least. But now, after I do finally put in a valid filename and I press the "submit" button, when it attempts to take me to the postNew1.asp page (the one in which the form is located on) it tells the page cannot be displayed:
The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.
--------------------------------------------------------------------------------
Please try the following:
Click the Refresh button, or try again later.
If you typed the page address in the Address bar, make sure that it is spelled correctly.
...etc, etc....
Have any clue as to why it might be doing this now? It's like I keep getting it to work but it's either with one or the other. I changed a few things around to try to fix it, I got it to go to the postNew1.asp page (with the posted data logged to the database) but I lose my alert boxes (gotta try to stop saying msgbox, sorry). And I can get it to work the other way but then it won't post the data nor go back to the page (so it looks like it's resetting itself).
I'll be leaving work in about three hours so if u're tied up, no worries I'll tough it out. And if I still don't get it fixed I'll ask u about it tomorrow. Take care
Toni Burgess
misskaos99@yahoo.com
forgot the code!
<%@ Language=VBScript%>
<% OPTION EXPLICIT%>
<% Response.Buffer = True %>
<% On Error Resume Next %>
<%
if Session("UserID") = "" then
Response.Redirect("index1.asp")
end if
%>
<%
if Session("UserType") <> "originator" then
Response.Redirect("noPostNew1.asp")
end if
%>
''''had to take the if statement out, it would not accept it (even with <% %>)-- it was displaying it on the webpage'''''
<html>
<head>
<title>Post New ECP/IMI Impact Form</title>
<script language = "javascript">
<!--
function checkData(){
if(!document.myForm.ecpFilename.value.length == 0 ) {
var sText = document.myForm.ecpFilename.value;
if (sText.indexOf('\\') == -1) {
alert('That is not a valid file name!');
return false;
}
}
if (document.myForm.ecpFilename.value.length == 0 ) {
alert("Please provide a valid file name!");
return false;
}
else {
alert('Sending data...');
myForm.submit();
return true;
}
}
-->
</script>
</head>
[...code...]
<table width="750" border="0">
<form name="myForm" method="post" enctype="multipart/form-data" onSubmit=checkData();>
'''''(even without the 'action="postNew1.asp" it still tries to take me to the page and says it's unavailable. if I try to send it to another page; i.e. 'action=viewAll1.asp' it never loads (just times out).)
[...code...]<%
Dim sFile
Dim o
sFile = Request.Form("ecpFilename")
if (sFile <> "" AND inStr(sFile, "\") <> -1) then
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
end if
[...code...]
Response.Redirect("viewAll1.asp")
else
schema = "http://schemas.microsoft.com/cdo/configuration/"
set cdoConf = CreateObject("CDO.Configuration")
with cdoConf.Fields
.Item(schema & "sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-server.ec.rr.com"
.update
End with
Set cdoMsg = CreateObject("CDO.Message")
With cdoMsg
Set .Configuration = cdoConf
.From = Session("UserEmail")
.To = "tb@ing.com"
.Cc = "tb@ing.com"
.Bcc = "9@hoo.com"
.TextBody = o.error
.Send
End with
set cdoMsg = nothing
'sJavaScript = "<script language=javascript>"
'sJavaScript = sJavaScript & "alert('Upload failed, IIS has been contacted!');"
'sJavaScript = sJavaScript & "self.location.href='./postNew1.asp';"
'sJavaScript = sJavaScript & "</scr" & "ipt>"
'response.write(sJavaScript)
'I didn't know if these may have been causing the problem, so i commented it out
end if
set o = nothing
end if
%>