elliottbenzle
asked on
Upload image width and height into a database
I'm trying to upload an image with it's width and height. Everything works fine until I add this:
,width, height to INSERT INTO
and
, " & myWidth & ", " & myHeight & " to VALUES ()
into the SQL. After adding this the image will upload but none of the information is inserted into the database. In the database the fields are named "width" and "height" and they are both set to datatype=number, fieldsize=single, decimal places=auto. I'm using an uplaod script called ASPUploader. Can someone tke a look at the code below and tell me why this is not working?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/yotshop. asp" -->
<!--#include file="Upload.asp" -->
<%
dim Uploader, File
set Uploader = GetASPUploader
Set File = Uploader.AddFile("file")
File.ValidFileTypes = "jpg,bmp,gif"
File.Maxsize = 1024*1024
File.Overwrite = false
Uploader.Destination = "C:\Inetpub\wwwroot\yotsho p\uploads"
Server.ScriptTimeout = 900
On Error Resume Next
Uploader.Upload
If Err Then
Response.Write err.description
Response.End()
End If
Dim myFile, myDescription, myWidth, myHeight
myFile=File.Name
myDescription=Uploader.For m("descrip tion")
Call sImageProperties(Uploader. Destinatio n & myFile)
set comadddetail = Server.CreateObject("ADODB .Command")
comadddetail.ActiveConnect ion = MM_yotshop_STRING
<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<< When I change this SQL things are no longer inserted into the DB >>
comadddetail.CommandText = "INSERT INTO uploadedfiles ( filename, description) VALUES ( '" & myFile & "', '" & myDescription & "' ) "
comadddetail.CommandType = 1
comadddetail.CommandTimeou t = 0
comadddetail.Prepared = true
comadddetail.Execute()
Set Uploader=Nothing
Sub sImageProperties(vImage)
Dim image, fs
Set fs=CreateObject("Scripting .FileSyste mObject")
If Not fs.fileExists(vImage) Then Exit Sub
Set image = loadpicture(vImage)
myWidth = Round(image.width / 26.4583)
myHeight = Round(image.height / 26.4583)
Set image = Nothing
Set fs=Nothing
End Sub
%>
,width, height to INSERT INTO
and
, " & myWidth & ", " & myHeight & " to VALUES ()
into the SQL. After adding this the image will upload but none of the information is inserted into the database. In the database the fields are named "width" and "height" and they are both set to datatype=number, fieldsize=single, decimal places=auto. I'm using an uplaod script called ASPUploader. Can someone tke a look at the code below and tell me why this is not working?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/yotshop.
<!--#include file="Upload.asp" -->
<%
dim Uploader, File
set Uploader = GetASPUploader
Set File = Uploader.AddFile("file")
File.ValidFileTypes = "jpg,bmp,gif"
File.Maxsize = 1024*1024
File.Overwrite = false
Uploader.Destination = "C:\Inetpub\wwwroot\yotsho
Server.ScriptTimeout = 900
On Error Resume Next
Uploader.Upload
If Err Then
Response.Write err.description
Response.End()
End If
Dim myFile, myDescription, myWidth, myHeight
myFile=File.Name
myDescription=Uploader.For
Call sImageProperties(Uploader.
set comadddetail = Server.CreateObject("ADODB
comadddetail.ActiveConnect
<<<<<<<<<<<<<<<<<<<<<<<<<<
comadddetail.CommandText = "INSERT INTO uploadedfiles ( filename, description) VALUES ( '" & myFile & "', '" & myDescription & "' ) "
comadddetail.CommandType = 1
comadddetail.CommandTimeou
comadddetail.Prepared = true
comadddetail.Execute()
Set Uploader=Nothing
Sub sImageProperties(vImage)
Dim image, fs
Set fs=CreateObject("Scripting
If Not fs.fileExists(vImage) Then Exit Sub
Set image = loadpicture(vImage)
myWidth = Round(image.width / 26.4583)
myHeight = Round(image.height / 26.4583)
Set image = Nothing
Set fs=Nothing
End Sub
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.