473,324 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

i got the error in llne no235

1
Expand|Select|Wrap|Line Numbers
  1. <%
  2. ' ------------------------------------------------------------------------------
  3. ' Container of Field Properties
  4. Class clsField
  5.     Public FileName
  6.     Public ContentType
  7.     Public Value
  8.     Public FieldName
  9.     Public Length
  10.     Public BinaryData
  11. End Class
  12. ' ------------------------------------------------------------------------------
  13. Class clsUpload
  14. ' ------------------------------------------------------------------------------
  15.     Private nFieldCount
  16.     Private oFields()
  17.     Private psFileFullPath
  18.     Private psError
  19.     Private psFileInputName
  20. ' ------------------------------------------------------------------------------
  21.     Public Property Get Count()
  22.         Count = nFieldCount
  23.     End Property
  24. ' ------------------------------------------------------------------------------
  25.     Public Default Property Get Field(ByRef asFieldName)
  26.         Dim lnLength
  27.         Dim lnIndex
  28.  
  29.         lnLength = UBound(oFields)
  30.  
  31.         If IsNumeric(asFieldName) Then
  32.             If lnLength >= asFieldName And asFieldName > -1 Then
  33.                 Set Field = oFields(asFieldName)
  34.             Else
  35.                 Set Field = New clsField
  36.             End If
  37.         Else
  38.             For lnIndex = 0 To lnLength
  39.                 If LCase(oFields(lnIndex).FieldName) = LCase(asFieldName) Then
  40.                     Set Field = oFields(lnIndex)
  41.                     Exit Property
  42.                 End If
  43.             Next
  44.             Set Field = New clsField
  45.         End If
  46.     End Property
  47. ' ------------------------------------------------------------------------------
  48.     Public Function Exists(ByRef avKeyIndex)
  49.         Exists = Not IndexOf(avKeyIndex) = -1
  50.     End Function
  51. ' ------------------------------------------------------------------------------
  52.     Public Property Get ValueOf(ByRef avKeyIndex)
  53.         Dim lnIndex
  54.         lnIndex = IndexOf(avKeyIndex)
  55.         if lnIndex = -1 Then Exit Property
  56.         ValueOf = oFields(lnIndex).Value
  57.     End Property
  58. ' ------------------------------------------------------------------------------
  59.     Public Property Get FileNameOf(ByRef avKeyIndex)
  60.         Dim lnIndex
  61.         lnIndex = IndexOf(avKeyIndex)
  62.         if lnIndex = -1 Then Exit Property
  63.         FileNameOf = oFields(lnIndex).FileName
  64.     End Property
  65. ' ------------------------------------------------------------------------------
  66.     Public Property Get LengthOf(ByRef avKeyIndex)
  67.         Dim lnIndex
  68.         lnIndex = IndexOf(avKeyIndex)
  69.         if lnIndex = -1 Then Exit Property
  70.         LengthOf = oFields(lnIndex).Length
  71.     End Property
  72. ' ------------------------------------------------------------------------------
  73.     Public Property Get BinaryDataOf(ByRef avKeyIndex)
  74.         Dim lnIndex
  75.         lnIndex = IndexOf(avKeyIndex)
  76.         if lnIndex = -1 Then Exit Property
  77.         BinaryDataOf = oFields(lnIndex).BinaryData
  78.     End Property
  79. ' ------------------------------------------------------------------------------
  80.     Private Function IndexOf(ByVal avKeyIndex)
  81.         Dim lnIndex
  82.  
  83.         If avKeyIndex = "" Then
  84.             IndexOf = -1
  85.         ElseIf IsNumeric(avKeyIndex) Then
  86.             avKeyIndex = CLng(avKeyIndex)
  87.             If nFieldCount > avKeyIndex And avKeyIndex > -1 Then
  88.                 IndexOf = avKeyIndex
  89.             Else
  90.                 IndexOf = -1
  91.             End If
  92.         Else
  93.             For lnIndex = 0 To nFieldCount - 1
  94.                 If LCase(oFields(lnIndex).FieldName) = LCase(avKeyIndex) Then
  95.                     IndexOf = lnIndex
  96.                     Exit Function
  97.                 End If
  98.             Next
  99.             IndexOf = -1
  100.         End If
  101.     End Function
  102. ' ------------------------------------------------------------------------------
  103. Public Property Let FileFullPath(sValue)
  104.     psFileFullPath = sValue
  105. End Property
  106. '___________________________________________________________________________________
  107. Public Property Get FileFullPath()
  108.     FileFullPath = psFileFullPath 
  109. End Property
  110. ' ------------------------------------------------------------------------------
  111. Public Property Let FileInputName(sValue)
  112.     psFileInputName = sValue
  113. End Property
  114. ' --------------------    ----------------------------------------------------------
  115. Public Function Save()
  116.     if psFileFullPath <> "" and psFileInputName <> "" then
  117.         'Save to connectionless client side recordset, write to stream,
  118.         'and persist stream.
  119.  
  120.         'would think you should be able to write directly to
  121.         'stream without recordset, but I could not get that to work
  122.  
  123.         On error resume next
  124.         binData = o.BinaryDataOf(psFileInputName)
  125.  
  126.         set rs = server.createobject("ADODB.RECORDSET")
  127.         rs.fields.append "FileName", 205, LenB(binData)
  128.         rs.open
  129.         rs.addnew
  130.          rs.fields(0).AppendChunk binData 
  131.  
  132.         if err.number = 0 then
  133.             set objStream = Server.CreateObject("ADODB.Stream")
  134.               objStream.Type  = 1
  135.                objStream.Open
  136.              objStream.Write rs.fields("FileName").value 
  137.             objStream.SaveToFile psFileFullPath, 2
  138.             objStream.close
  139.             set objStream = Nothing
  140.  
  141.         ENd if
  142.         rs.close
  143.         set rs = nothing
  144.         psError = Err.Description
  145. else
  146.         psError = "One or more required properties (FileFullPath and/or FileInputName) not set"
  147.  
  148.   End If
  149.  
  150.  
  151. End Function
  152.  
  153. Public Property Get Error()
  154.     Error = psError
  155. End Property
  156.  
  157.  
  158. ' ------------------------------------------------------------------------------
  159.     Public Property Get ContentTypeOf(ByRef avKeyIndex)
  160.         Dim lnIndex
  161.         lnIndex = IndexOf(avKeyIndex)
  162.         if lnIndex = -1 Then Exit Property
  163.         ContentTypeOf = oFields(lnIndex).ContentType
  164.     End Property
  165.  
  166. ' ------------------------------------------------------------------------------
  167.     Private Sub Class_Terminate()
  168.         Dim lnIndex
  169.         For lnIndex = 0 To nFieldCount - 1
  170.             Set oFields(0) = Nothing
  171.         Next
  172.     End Sub
  173. ' ------------------------------------------------------------------------------
  174.     Private Sub Class_Initialize()
  175.  
  176.         Dim lnBytes                ' Bytes received from the client
  177.         Dim lnByteCount            ' Number of bytes received
  178.         Dim lnStartPosition        ' Position at which content begins
  179.         Dim lnEndPosition        ' Position at which content ends
  180.  
  181.         Dim loDic                ' Contains properties of each
  182.                                 ' specific field
  183.                                 ' Local dictionary object(s) 
  184.                                 ' to be appended to class-scope
  185.                                 ' dictioary object.
  186.  
  187.         Dim lnBoundaryBytes        ' Bytes contained within the current boundary
  188.         Dim lnBoundaryStart        ' Position at wich the current boundary begins
  189.                                 ' within the lnBytes binary data.
  190.         Dim lnBoundaryEnd        ' Position at wich the current boundary ends
  191.                                 ' within the lnBytes binary data.
  192.         Dim lnDispositionPosition
  193.  
  194.         Dim lsFieldName            ' Name of the current field being parsed from
  195.                                 ' Binary Data
  196.         Dim lsFileName            ' Name of the file within the current boundary
  197.         Dim lnFileNamePosition    ' Location of file name within current boundary
  198.         Dim loField                ' clsField Object
  199.         Dim lsValue                ' Value of the current field
  200.         Dim lsContentType        ' ContentType of the binary file (MIME Type)
  201.  
  202.         ' Initialize Fields
  203.         nFieldCount = 0
  204.         ReDim oFields(-1)
  205.  
  206.         ' Read the bytes (binary data) into memory    
  207.         lnByteCount = Request.TotalBytes
  208.         lnBytes = Request.BinaryRead(lnByteCount)
  209.  
  210.         'Get the lnBoundaryBytes
  211.         lnStartPosition = 1
  212.         lnEndPosition = InstrB(lnStartPosition, lnBytes, CStrB(vbCr))
  213.  
  214.         If lnEndPosition >= lnStartPosition Then
  215.             lnBoundaryBytes = MidB(lnBytes, lnStartPosition, lnEndPosition - lnStartPosition)
  216.         End If
  217.  
  218.         lnBoundaryStart = InstrB(1, lnBytes, lnBoundaryBytes)
  219.  
  220.  
  221.         ' Loop until the BoundaryBytes begin with "--"
  222.         Do Until (lnBoundaryStart = InstrB(lnBytes, lnBoundaryBytes & CStrB("--")))
  223.  
  224.             ' All data within this boundary is stored within a local dictionary
  225.             ' to be appended to the class-scope dictionary.
  226.  
  227.             ReDim Preserve oFields(nFieldCount)
  228.             nFieldCount = nFieldCount + 1
  229.  
  230.             Set loField = New clsField
  231.  
  232.             lnDispositionPosition = InstrB(lnBoundaryStart, lnBytes, CStrB("Content-Disposition"))
  233.  
  234.             ' Get an object name
  235.             lnStartPosition = InstrB(lnDispositionPosition, lnBytes, CStrB("name=")) + 6
  236.             lnEndPosition = InstrB(lnStartPosition, lnBytes, CStrB(""""))
  237.             lsFieldName = CStrU(MidB(lnBytes, lnStartPosition, lnEndPosition - lnStartPosition))
  238.             loField.FieldName = lsFieldName
  239.  
  240.             ' Get the location fo the file name.
  241.             lnFileNamePosition = InstrB(lnBoundaryStart, lnBytes, CStrB("filename="))
  242.             lnBoundaryEnd = InstrB(lnEndPosition, lnBytes, lnBoundaryBytes)
  243.  
  244.             'Test if object is a file
  245.             If Not lnFileNamePosition = 0 And lnFileNamePosition < lnBoundaryEnd Then
  246.  
  247.                 ' Parse Filename
  248.                 lnStartPosition = lnFileNamePosition + 10
  249.                 lnEndPosition =  InstrB(lnStartPosition, lnBytes, CStrB(""""))
  250.                 lsFileName = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition))
  251.                 loField.FileName = lsFileName                
  252.  
  253.                 ' Parse Content-Type
  254.                 lnStartPosition = InstrB(lnEndPosition,lnBytes,CStrB("Content-Type:")) + 14
  255.                 lnEndPosition = InstrB(lnStartPosition,lnBytes,CStrB(vbCr))
  256.                 lsContentType = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition))
  257.                 loField.ContentType = lsContentType
  258.  
  259.                 ' Parse Content
  260.                 lnStartPosition = lnEndPosition + 4
  261.                 lnEndPosition = InstrB(lnStartPosition,lnBytes,lnBoundaryBytes)-2
  262.                 lsValue = MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition)
  263.                 loField.BinaryData = lsValue & CStrB(vbNull)
  264.                 loField.Length = LenB(lsValue)
  265.             Else
  266.  
  267.                 ' Parse Content
  268.                 lnStartPosition = InstrB(lnDispositionPosition, lnBytes, CStrB(vbCr)) + 4
  269.                 lnEndPosition = InstrB(lnStartPosition, lnBytes, lnBoundaryBytes) - 2
  270.                 lsValue = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition))
  271.                 loField.Value = lsValue
  272.                 loField.Length = Len(lsValue)
  273.             End If
  274.  
  275.             Set oFields(UBound(oFields)) = loField
  276.  
  277.             'Loop to next object
  278.             lnBoundaryStart = InstrB(lnBoundaryStart + LenB(lnBoundaryBytes), lnBytes, lnBoundaryBytes)
  279.  
  280.             Set loField = Nothing
  281.  
  282.         Loop
  283.  
  284.     End Sub
  285. ' ------------------------------------------------------------------------------
  286.     Private Function CStrU(ByRef psByteString)
  287.         Dim lnLength
  288.         Dim lnPosition
  289.         lnLength = LenB(psByteString)
  290.         For lnPosition = 1 To lnLength
  291.             CStrU = CStrU & Chr(AscB(MidB(psByteString, lnPosition, 1)))
  292.         Next
  293.     End Function
  294. ' ------------------------------------------------------------------------------
  295.     Private Function CStrB(ByRef psUnicodeString)
  296.         Dim lnLength
  297.         Dim lnPosition
  298.         lnLength = Len(psUnicodeString)
  299.         For lnPosition = 1 To lnLength
  300.             CStrB = CStrB & ChrB(AscB(Mid(psUnicodeString, lnPosition, 1)))
  301.         Next
  302.     End Function
  303. ' ------------------------------------------------------------------------------
  304. End Class
  305. ' ------------------------------------------------------------------------------
  306. %>
Sep 13 '07 #1
1 1449
jhardman
3,406 Expert 2GB
what kind of error was it?

By the way, I'm going to move this to the .NET forum; there are no classes in ASP classic

Jared
Sep 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
1
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly,...
0
by: mchuc7719 | last post by:
Hello, I have a Vb.Net 2005 ClassLibrary, when I try to compile using MSBee, only get errors. Before I to run the command line, I open in notepad the .vbproj and I was add the next line: ...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.