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.CreateObject("Persits.Upload")
' Capture uploaded file. Save returns the number of files uploaded
'Count = Upload.Save(Path)
'If Count = 0 Then
'Response.Write "message"
'Response.End
'Else
' Obtain File objects representing uploaded files
'Set File1 = Upload.Files("MyFile1") 'name of input object
'Set File2 = Upload.Files("MyFile2")
' Is this a valid image file?
'If File1.ImageType <> "UNKNOWN" or File2.ImageType <> "UNKNOWN" Then
' create instance of AspJpeg object
'Set jpeg1 = Server.CreateObject("Persits.Jpeg")
'Set jpeg2 = Server.CreateObject("Persits.Jpeg")
' 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.OriginalWidth * Upload.Form("scale") / 100
'jpeg1.Height = jpeg1.OriginalHeight * Upload.Form("scale") / 100
' resize image accoring to "scale" option.
' notice that we cannot use Request.Form, so we use Upload.Form instead.
'jpeg2.Width = jpeg2.OriginalWidth * Upload.Form("scale") / 100
'jpeg2.Height = jpeg2.OriginalHeight * Upload.Form("scale") / 100
'SavePath = Path & "\small_" & File1.ExtractFileName
'SavePath = Path & "\small_" & File2.ExtractFileName
' AspJpeg always generates JPEG thumbnails regardless of original format.
' If the original file was not a JPEG, append .JPG extension.
'If UCase(Right(SavePath, 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={Microsoft Access Driver (*.mdb)};DBQ=" & 'Server.MapPath("\iisadmin") &
"\db\lobal.mdb;" & ";" & "Persist Security Info=False"
'Set rs = Server.CreateObject("adodb.recordset")
'rs.Open "alte", strConnect, 1, 3
'rs.AddNew
' Use File.Binary to access binary data of uploaded file.
'rs("original_image1").Value = File.Binary
'Set ThumbFile1 = Upload.OpenFile(SavePath)
'rs("thumbnail1").Value = ThumbFile.Binary
' Use File.Binary to access binary data of uploaded file.
'rs("original_image2").Value = File2.Binary
'Set ThumbFile2 = Upload.OpenFile(SavePath)
'rs("thumbnail2").Value = ThumbFile2.Binary
....
the both fields('original_image1 and 'original_image2) upload only the first picture ! where is the mistake ?
thank you
dan
|