Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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
  #1 (permalink)  
Old October 27th, 2006, 10:30 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 Saving data using form

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&nbsp;


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....
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
__________________
T.B.
misskaos99@yahoo.com
Reply With Quote
  #2 (permalink)  
Old October 27th, 2006, 02:10 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

Caught an On Error Resume Next in the clsUpload.asp
Commented it out.
Code:
    'On error resume next
        binData = o.BinaryDataOf(psFileInputName)    
        set rs = server.createobject("ADODB.RECORDSET")
        rs.fields.append "FileName", 128, 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<--line 136
            objStream.close
            set objStream = Nothing

        'ENd if
Now I'm receiving this error:
ADODB.Stream error '800a0bbc'

Write to file failed.

/ecp/ecpSQL/clsUpload.asp, line 136
for this line:
objStream.SaveToFile psFileFullPath , 2


T.B.
misskaos99@yahoo.com
Reply With Quote
  #3 (permalink)  
Old October 27th, 2006, 03:04 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

More reading for you =P (I know you love it)

http://classicasp.aspfaq.com/files/d...bc-errors.html

-------------------------
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.

^^Thats my signature
Reply With Quote
  #4 (permalink)  
Old October 27th, 2006, 03:16 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

Yup Yup. I love it so much, I've already read it (probably about 20 times). My permissions are set correctly. IUSER has full control.
Still not working tho.

T.B.
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
Saving Form Contents Borhani Excel VBA 2 January 20th, 2008 12:55 PM
Saving data to a table through form input misskaos Classic ASP Basics 16 October 2nd, 2006 11:54 AM
Saving Form Data Earl Hickey ASP.NET 1.0 and 1.1 Basics 5 July 25th, 2006 01:10 PM
Close form without saving cqprod27 Access VBA 8 June 4th, 2004 08:14 AM



All times are GMT -4. The time now is 09:58 AM.


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