upload multiple files in db with persits aspjpeg

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dann2
    New Member
    • May 2007
    • 1

    upload multiple files in db with persits aspjpeg

    hello,
    i try to upload in an access db two pictures at the same time. i use the adjusted sample code from persits. it looks like this:
    ...
    '<%
    ' Create an instance of AspUpload object
    'Set Upload = Server.CreateOb ject("Persits.U pload")
    ' Capture uploaded file. Save returns the number of files uploaded
    'Count = Upload.Save(Pat h)
    'If Count = 0 Then
    'Response.Write "message"
    'Response.End
    'Else
    ' Obtain File objects representing uploaded files
    'Set File1 = Upload.Files("M yFile") 'name of input object
    'Set File2 = Upload.Files("M yFile2")
    ' Is this a valid image file?
    'If File1.ImageType <> "UNKNOWN" or File2.ImageType <> "UNKNOWN" Then
    ' create instance of AspJpeg object
    'Set jpeg1 = Server.CreateOb ject("Persits.J peg")
    'Set jpeg2 = Server.CreateOb ject("Persits.J peg")
    ' open uploaded file
    'jpeg1.Open( File1.Path )
    'jpeg2.Open( File2.Path )
    ' resize image accoring to "scale" option.
    ' notice that we cannot use Request.Form, so we use Upload.Form instead.
    'jpeg1.Width = jpeg1.OriginalW idth * Upload.Form("sc ale") / 100
    'jpeg1.Height = jpeg1.OriginalH eight * Upload.Form("sc ale") / 100

    ' resize image accoring to "scale" option.
    ' notice that we cannot use Request.Form, so we use Upload.Form instead.
    'jpeg2.Width = jpeg2.OriginalW idth * Upload.Form("sc ale") / 100
    'jpeg2.Height = jpeg2.OriginalH eight * Upload.Form("sc ale") / 100

    'SavePath = Path & "\small_" & File1.ExtractFi leName
    'SavePath = Path & "\small_" & File2.ExtractFi leName
    ' AspJpeg always generates JPEG thumbnails regardless of original format.
    ' If the original file was not a JPEG, append .JPG extension.
    'If UCase(Right(Sav ePath, 3)) <> "JPG" Then
    'SavePath = SavePath & ".jpg"
    'End If
    'jpeg.Save SavePath
    'jpeg2.Save SavePath
    ' Using ADO, save both images in the database along with description.
    'strConnect = "DRIVER={Micros oft Access Driver (*.mdb)};DBQ=" & 'Server.MapPath ("\iisadmin" ) &
    "\db\lobal.mdb; " & ";" & "Persist Security Info=False"
    'Set rs = Server.CreateOb ject("adodb.rec ordset")
    'rs.Open "alte", strConnect, 1, 3
    'rs.AddNew
    ' Use File.Binary to access binary data of uploaded file.
    'rs("original_i mage1").Value = File.Binary
    'Set ThumbFile1 = Upload.OpenFile (SavePath)
    'rs("thumbnail1 ").Value = ThumbFile.Binar y
    ' Use File.Binary to access binary data of uploaded file.
    'rs("original_i mage2").Value = File2.Binary
    'Set ThumbFile2 = Upload.OpenFile (SavePath)
    'rs("thumbnail2 ").Value = ThumbFile2.Bina ry

    ....
    th both fields('origina l_image1 and 'original_image 2) upload only the first picture ! where is the mistake ?
    thank you
    dan
Working...