Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old October 6th, 2006, 11:47 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

The caution box in IE means that there is a javascript syntax error. Umm. Is the <script language="javascript"> between your <head></head> tags?

And yes, EVERYONE likes quickies. }=]

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
Reply With Quote
  #12 (permalink)  
Old October 6th, 2006, 11:57 AM
Authorized User
 
Join Date: Sep 2006
Location: Jax, NC, USA.
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos
Default

No, does it need to be? I wouldn't think so, but lemme try it.........


***
No, i tried puttin' it in there and that's definitely not working. I might need to give this one a rest for an hour or something and do something else for a little while-- I think I'll print it all out and just sit down and read the whole thing again, try to see what the heck is going wrong in there.

Toni Burgess
misskaos99@yahoo.com
Reply With Quote
  #13 (permalink)  
Old October 6th, 2006, 12:22 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Something I noticed you are doing this:

sFileSplit = split(o.FileNameOf("ecpFilename"), "\")
sFile = sFileSplit(Ubound(sFileSplit))

You should do this:

if instr(o.FileNameOf("ecpFilename"), "\") then
sFileSplit = split(o.FileNameOf("ecpFilename"), "\")
sFile = sFileSplit(Ubound(sFileSplit))
else
//user didnt submit a good path
end if

The subscript error is occuring because when you try to split, there is no character to split on =
My first page might look something like this:
<%@ LANGUAGE="VBSCRIPT"%>
<% Option Explicit %>
<%
if Session("UserID") = "" then
Response.Redirect("index1.asp")
end if

if LCase(Session("UserType")) <> "originator" then
Response.Redirect("noPostNew1.asp")
end if
%>
<html>
<head>
<title>something</title>

<script language="javascript">
<!--

function checkData(){
     if (document.myForm.ecpFilename.value.length == 0 ) {
     alert("missing file");
     return false;
     }
    else {
         alert("Sending data...");
     myForm.submit();
         return true;
    }
}
-->
</script>
</head>
<body>

<form method="post" action="postNew1.asp" enctype="multipart/form-data" name="myForm">
<P><INPUT type="file" name="ecpFilename"></P>
<P><INPUT type="button" onclick="checkData()" value="Button"></P>
</form>
</body>
</html>

</file>

my second page might look like:

<%@ LANGUAGE="VBSCRIPT"%>
<% Option Explicit %>
<%
set o = new clsUpload
if o.Exists("submitButton") then

if instr(o.FileNameOf("ecpFilename"), "\") then
sFileSplit = split(o.FileNameOf("ecpFilename"), "\")
sFile = sFileSplit(Ubound(sFileSplit))

'Upload filename
o.FileInputName = "ecpFilename"
o.FileFullPath = Server.MapPath(".") & "\ecpFiles\" & sFile
o.save

'If not error redirect to complete message
if o.Error = "" then

    Dim pSQLStatement, pConnection
    Dim pRS, objMail
    Dim pEcpNumber, pEcpTitle, pEcpFilename, pEcpOriginator, pEcpDateDistributed, pEcpDateDue

    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"))


pConnection = "Provider=SQLOLEDB.1;UID=sa;PWD=;Initial Catalog=ecpDatabase2SQL;Data Source=localhost"
Set pRS = server.CreateObject("ADODB.RecordSet")

pRS.open "INSERT INTO ecpForms (ecpNumber, ecpTitle, ecpFilename, ecpOriginator, ecpDateDistributed, ecpDateDue) VALUES ('" & pEcpNumber & "', '" & pEcpTitle & "', '" & pEcpFilename & "', '" & pEcpOriginator & "', '" & pEcpDateDistributed & "', '" & pEcpDateDue & "') ", pConnection
else
%>
<script language="JavaScript">
alert('You provided an invalid file name!');
self.location.href='PostNew1.asp';
</script>
<%
end if
%>

hth

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
Reply With Quote
  #14 (permalink)  
Old October 6th, 2006, 01:32 PM
Authorized User
 
Join Date: Sep 2006
Location: Jax, NC, USA.
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos
Default

I'm trying to implement it, but seems like no matter what I do to the dag on thang it still gives me the same error in the same spot.

You have your example set up in two pages, where as I have all that on one page. But even with adding it the way you have it above (except all in just one page) it's still giving me an error, and I have yet to receive an alert box.

Toni Burgess
misskaos99@yahoo.com
Reply With Quote
  #15 (permalink)  
Old October 6th, 2006, 01:45 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

O.o That positively doesnt make any sense. How do you determine when the form handler portion of your code will execute?

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
Reply With Quote
  #16 (permalink)  
Old October 6th, 2006, 02:11 PM
Authorized User
 
Join Date: Sep 2006
Location: Jax, NC, USA.
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos
Default

I give up (for now).

It must not be meant for me to figure it out right now. I've changed everything back to how it was working before(which I'm surprised I even remembered). It does what they asked of me, so that's fine for me right now. Thanks :)

I'll figure the extras out later, right now my mind is too cluttered with frustration; if I have anymore failed attempts I may just start crying (remember: laugh about everything, cry about nothing). ;) It'll be okay tho. Most times when you're over frustrated you don't see nor think clearly. So, once I have cleared my mind of it for a little while, I may be able to see what I'm doing wrong when I go back to it. (Cause right now I'm thinking "Down with Java! Down with ASP!" lol


Toni Burgess
misskaos99@yahoo.com
Reply With Quote
  #17 (permalink)  
Old October 6th, 2006, 02:14 PM
Authorized User
 
Join Date: Sep 2006
Location: Jax, NC, USA.
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos
Default

Oh but speaking of which, do you know any good websites for program ideas? Ideas for creating programs? I know that sounds kind of silly, but now I have to think of something to create! (I think this is the hardest part--especially when you have no specific needs right now, i.e. no store to manage, records to keep track of, etc).

Toni Burgess
misskaos99@yahoo.com
Reply With Quote
  #18 (permalink)  
Old October 6th, 2006, 02:16 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

LoL. Its normal to get frustrated, it happens to everyone! (I for example just about threw my mouse across my office because I couldn't get this stupid Regular Expression to match a string correctly...all is now well and my mouse remains in one piece)

As far as your problem goes, I am not sure it is something obscure. If i had the code on my machine and could look through it I might figure it out but se la vi. =P

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
Reply With Quote
  #19 (permalink)  
Old October 6th, 2006, 02:47 PM
Authorized User
 
Join Date: Sep 2006
Location: Jax, NC, USA.
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos
Default

not very good at Spanish, if that's Spanish (looked like it lol), but hey I did pass it all four times with a 98 or higher! (two classes in high school, two in college).... but anyway I'm gettin' off subject lol.

I've taken a breather! I thought of program ideas to no avail! I am ready to tackle this thing again lol. No tears nor frustration, I am fully boosted with confidence this time!

Oh and by the way, the code is on it's way lol
;)

Toni Burgess
misskaos99@yahoo.com
Reply With Quote
  #20 (permalink)  
Old October 7th, 2006, 12:09 PM
Authorized User
 
Join Date: Sep 2006
Location: Jax, NC, USA.
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos
Default

Ok I found the problem for my error page. I was looking at the wrong code in my postNew1.asp here's what I did:

<%

set o = new clsUpload
if o.Exists("submitButton") then

  'get client file name without path
dim strMessage
 if o.FileNameOf("ecpFilename") = "" then

response.redirect("postNew1.asp")
else

  sFileSplit = split(o.FileNameOf("ecpFilename"), "\")
  sFile = sFileSplit(Ubound(sFileSplit))



  'Upload filename
  o.FileInputName = "ecpFilename"
o.FileFullPath = Server.MapPath(".") & "\ecpFiles\" & sFile
  o.save
end if

'this little if then else statement stops the page from going to the error page when the user does not enter a filename. I don't know how I could have missed this, it makes perfect sense that this is why i kept getting an error page. But anyWHO, I got it going back to the postNew1.asp page but I still don't have the alert working. However, I figured I needed to call it somewhere here, right before the response.redirect ?



Toni Burgess
misskaos99@yahoo.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IBM AS400 Message Errors to show them in .NET appl julenis SQL Server 2000 2 July 12th, 2006 01:45 PM
IBM AS400 Message Errors to show them in .NET appl julenis C# 0 July 12th, 2006 10:28 AM
DTS, SQL Server, Show PK value in err message zpluug .NET Framework 2.0 7 March 10th, 2006 12:50 AM
how to show a confirmation message? noor ASP.NET 1.0 and 1.1 Basics 10 May 16th, 2005 03:12 AM
I cannot disabled show windows message “internet e woland666 Visual C++ 0 June 28th, 2004 05:35 AM



All times are GMT -4. The time now is 07:55 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.