File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/beheer/asp/upload/upload-foto.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/INDOORSKI_WRITER.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="/css/standaard.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- Dit script wordt aangeroepen door de pagina toevoegen-foto.asp-->
<%
' Open een instance voor het uploaden van de foto
Set Upload = Server.CreateObject("Persits.Upload")
' Sla de geslecteerde foto op in het geheugen.
Count = Upload.Save
If Count = 0 Then
Response.Write "<center><span class=""BEH-Style02""><hr>Er is geen foto geslecteerd probeer het <A HREF=""/asp/fotoalbum/toevoegen-foto.asp"">opnieuw</a><br><hr></span></center>"
Response.End
Else
' Obtain File object representing uploaded file
Set File = Upload.Files(1)
' Is this a valid image file?
If File.ImageType <> "UNKNOWN" Then
' create instance of AspJpeg object
Set jpeg = Server.CreateObject("Persits.Jpeg")
' open uploaded file from memory
jpeg.OpenBinary( File.Binary )
' Using ADO, save both image and thumbnail in the database along with description.
strConnect = MM_INDOORSKI_WRITER_STRING
Set rs = Server.CreateObject("adodb.recordset")
rs.Open "TABEL_IMAGES", strConnect, 1, 3
rs.AddNew
jpeg.Height = Upload.Form("scale1")
jpeg.Width = Jpeg.OriginalWidth * Upload.Form("scale1") / Jpeg.OriginalHeight
' Use Jpeg.Binary to access binary data. For now, it is the original image
rs("original_image").Value = Jpeg.Binary
' resize image accoring to "scale" option.
' notice that we cannot use Request.Form, so we use Upload.Form instead.
'jpeg.Width = jpeg.OriginalWidth * Upload.Form("scale") / 100
'jpeg.Height = jpeg.OriginalHeight * Upload.Form("scale") / 100
jpeg.Height = Upload.Form("scale2")
jpeg.Width = Jpeg.OriginalWidth * Upload.Form("scale2") / Jpeg.OriginalHeight
'jpeg.Width = Upload.Form("scale")
'jpeg.Height = Jpeg.OriginalHeight * Upload.Form("scale") / Jpeg.OriginalWidth
' Now Jpeg contains a resized version of the original file. Save it too.
rs("thumbnail").Value = Jpeg.Binary
' Obtain description from form using Upload.Form (not Request.Form)
rs("serie") = Upload.Form("serie")
rs.Update
rs.Close
Set rs = Nothing
Response.Write "<center><span class=""BEH-Style02""><hr>Gelukt de geselecteerde foto is opgeslagen in de database<br><hr></span></center>"
Else
Response.Write "<center><span class=""BEH-Style02""><hr>De foto die is geslecteerd is geen geldig bestandsformaat probeer het <A HREF=""/asp/fotoalbum/toevoegen-foto.asp"">opnieuw</a><br><hr></span></center>"
Response.End
End If
End If
%>
</BODY>
</HTML>