This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1895D.DB4B17E0
Content-Type: text/plain;
charset="iso-8859-1"
Hi all, really simple prob
I have built and app that upload pics. Works fine and will overwrite pics
and redirect to a display page.
Howevre if I attempt to upload a new image (Not overwrite) nothing happens
(Looks like the form does'nt submit or something.
No doubt it is something mind dumbingly simple...but I can't see it.
Any suggestions much appreaciated.
Thanks
Sam
Here is my code:
<!--#include file="../include/connection.asp"-->
<!--#include file="../include/adovbs.asp"-->
<!--#include file="../include/check.asp"-->
<!--#include virtual="../include/functions.asp" -->
<%
dim currentStory
if Request.QueryString("id") <> "" then
currentStory = Request.QueryString("id")
else
currentStory = ""
end if
if request.querystring("delete") <> "" then
strFN = request.querystring("delete")
Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFile(Server.MapPath(strFN))
f1.Delete
end if
dim NewsID, strInsert, strValues, objTypeRs, struserPicPath, thumb, full,
thispage, strExt, strExt1
thispage = request.servervariables("URL")
NewsID = request.querystring("id")
intID = request.querystring("id")
thumb = "_thumb"
full = "_full"
strUserPicPath = server.mappath ("/article-images")
'UserFileName = (objUpl.form ("ThumbPic"))
set objRs = server.createobject("ADODB.recordset")
set rsMember = server.createobject("ADODB.recordset")
set objUpl = server.createobject("SoftArtisans.FileUp")
set objCmd = Server.CreateObject("ADODB.Command")
set objCmd1 = Server.CreateObject("ADODB.Command")
objUpl.OverWriteFiles = True
'---------------------------------------------------------------------------
-------------
Select case (objUpl.form("action"))
'Add a
thumbnail-------------------------------------------------------------------
---------
case "uploadthumb"
'---------------------------------------------------------------------------
-------------
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objGraph = Server.CreateObject("ShotGraph.Image")
if not (objUpl.form ("ThumbPic").isEmpty) then
intImage
objGraph.GetFileDimensions(objUpl.Form("ThumbPic").ServerName,x,y)
If intImage=1 or intImage=2 Then
If x > 90 or y > 120 Then 'dimensions of the image
Response.redirect "attachements.asp?id=" & NewsID & "&picOpt=" &
server.urlEncode ("4")
End if
End if
end if
objUpl.OverWriteFiles = True
'---------------------------------------------------------------------------
----------------
if not (objUpl.form ("ThumbPic").isEmpty) then
CheckFile strUserPicPath & "/" & NewsID & ".gif",True
CheckFile strUserPicPath & "/" & NewsID & ".GIF",True
CheckFile strUserPicPath & "/" & NewsID & ".jpg",True
CheckFile strUserPicPath & "/" & NewsID & ".JPG",True
CheckFile strUserPicPath & "/" & NewsID & ".JPEG",True
If Err.Number = 0 Then
If Right(objUpl.UserFileName,3) = "gif" then
objUpl.SaveAs strUserPicPath & "\" & NewsID & thumb & ".gif"
ElseIf Right(objUpl.UserFileName,3) = "jpg" then
objUpl.SaveAs strUserPicPath & "\" & NewsID & thumb & ".jpg"
'objUpl.SaveAs strUserPicPath & "\" & intID & ".jpg"
ElseIf Right(objUpl.UserFileName,3) = "GIF" then
objUpl.SaveAs strUserPicPath & "\" & NewsID & thumb
& ".gif"
ElseIf Right(objUpl.UserFileName,3) = "JPG" then
objUpl.SaveAs strUserPicPath & "\" & NewsID & thumb
& ".jpg"
ElseIf Right(objUpl.UserFileName,3) = "jpeg" then
objUpl.SaveAs strUserPicPath & "\" & NewsID & thumb
& ".jpg"
ElseIf Right(objUpl.UserFileName,3) = "JPEG" then
objUpl.SaveAs strUserPicPath & "\" & NewsID & thumb
& ".jpg"
End If
End If
strExt = GetFileExtension(objUpl.Form("ThumbPic").UserFileName)
if strExt = ".jpg" then
strSql = "UPDATE tblNews SET thumbtype = 10 WHERE id = " & intID
elseif strExt =".gif" then
strSql = "UPDATE tblNews SET thumbtype = 11 WHERE id = " & intI
set objCmd = Server.CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = Conn
objCmd.CommandText = strSQL
objCmd.CommandType = 1
objCmd.execute
Set objCmd = Nothing
end if
end if
response.redirect "show1.asp?id=" & NewsID
'Full image upload
'---------------------------------------------------------------------------
----------------
case "uploadfull"
Set objFSO1 = Server.CreateObject("Scripting.FileSystemObject")
Set objGraph1 = Server.CreateObject("ShotGraph.Image")
if not (objUpl.form ("fullNewsPic").isEmpty) then
intImage
objGraph1.GetFileDimensions(objUpl.Form("fullNewsPic").ServerName,x,y)
If intImage=1 or intImage=2 Then
If x > 370 or y > 250 Then 'dimensions of the image
Response.redirect "attachements.asp?id=" & NewsID & "&picOpt=" &
server.urlEncode ("5")
'Response.redirect "uploadtest.asp?picOpt=" & server.urlEncode ("4")
End if
End if
end if
'---------------------------------------------------------------------------
----------------
if not (objUpl.form ("fullNewsPic").isEmpty) then
'if (objUpl.form ("fullNewsPic").isEmpty) then
'objUpl.OverWriteFiles = True
CheckFile strUserPicPath & "\" & intID & ".gif",True
CheckFile strUserPicPath & "\" & intID & ".jpg",True
CheckFile strUserPicPath & "\" & intID & ".GIF",True
CheckFile strUserPicPath & "\" & intID & ".JPG",True
If Err.Number = 0 Then
If Right(objUpl.UserFileName,3) = "gif" then
objUpl.SaveAs strUserPicPath & "\" & intID & full & ".gif"
ElseIf Right(objUpl.UserFileName,3) = "jpg" then
objUpl.SaveAs strUserPicPath & "\" & intID & full &
".jpg"
ElseIf Right(objUpl.UserFileName,3) = "GIF" then
objUpl.SaveAs strUserPicPath & "\" & intID & full &
".gif"
ElseIf Right(objUpl.UserFileName,3) = "JPG" then
objUpl.SaveAs strUserPicPath & "\" & intID & full &
".jpg"
ElseIf Right(objUpl.UserFileName,3) = "jpeg" then
objUpl.SaveAs strUserPicPath & "\" & intID & full &
".jpg"
End If
End If
strExt1 = GetFileExtension(objUpl.Form("fullNewsPic").UserFileName)
if strExt1 = ".jpg" then
strSql1 = "UPDATE tblNews SET picturetype = 10 WHERE id = " & intID
Elseif strExt1 = ".gif" then
strSql1 = "UPDATE tblNews SET picturetype = 11 WHERE id = " & intID
set objCmd1 = Server.CreateObject("ADODB.Command")
Set objCmd1.ActiveConnection = Conn
objCmd1.CommandText = strSQL1
objCmd1.CommandType = 1
objCmd1.execute
Set objCmd1 = Nothing
end if
END IF
'end if
response.redirect "show.asp?id=" & NewsID
end select
%>