ASP 网站上的图片上传器出现问题
Having trouble with a image uploader on an ASP website
我在属性网站中内置了一个图片上传器,它工作正常,现在每当我使用图片上传器时,它都会给我一个 500 内部服务器错误消息。
我的错误日志是这样的,有人知道如何理解它告诉我的内容吗?
错误日志文件 -
https://pastebin.com/QtenvubM
上传者代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/connection_includes/prop_search_conn_str.asp" -->
<%
Fkey = request.QueryString("Fkey")
property_ID = request.QueryString("property_ID")
uploadpath = "/palm_group/property_images/prop_no_" & property_ID
'------------------------------------------------------------
Set fs=Server.CreateObject("Scripting.FileSystemObject")
If fs.FolderExists(server.MapPath(uploadpath)) = true Then
folder_exists = "yes"
Else
folder_exists = "no"
End If
'response.write uploadpath
'response.write folder_exists
'response.write server.MapPath(uploadpath)
'------------------------------------------------------------
if folder_exists = "no" then
fs.createfolder(server.MapPath(uploadpath))
end if
'-------------------------------------------------------------
Sub ImageUpload()
Server.ScriptTimeout = 555 '[Two Minute Timeout (this will allow upto 2 minutes of activity before ending)]
Set Upload = Server.CreateObject("Persits.Upload")
Count = Upload.Save(Server.MapPath(uploadpath))
For Each File in Upload.Files
LOCAL_LOC = File.Path
REMOTE_LOC = RootDir & replace(file.path, Server.mappath(uploadpath) + "\", "")
FILE_SIZE = File.Size
session("file") = File.filename
Next
Set Upload = Nothing
End Sub
'-------------------------------------------------------------
Call ImageUpload()
'-------------------------------------------------------------
if session("file") = "" then
set fname=nothing
set fs=nothing
response.redirect "/CMS_ADMIN_FILES/edit_property.asp?error=nofile&unique_ID=" & property_ID & "&Fkey=" & Fkey
end if
'-------------------------------------------------------------
file_extension = lcase(right(session("file"),4))
file_is_image = "false"
if file_extension = "jpeg" then file_extension = ".jpg"
if file_extension = ".jpg" then file_is_image = "true"
if file_extension = ".png" then file_is_image = "true"
if file_extension = ".gif" then file_is_image = "true"
if file_is_image <> "true" then
If fs.FileExists(server.MapPath(uploadpath & "\" & session("file"))) = true Then
fs.DeleteFile(server.MapPath(uploadpath & "\" & session("file")))
end if
set fname=nothing
set fs=nothing
response.redirect "/CMS_ADMIN_FILES/edit_property.asp?error=notimage&unique_ID=" & property_ID & "&Fkey=" & Fkey
else
' response.write file_extension
' response.write "<br>"
' response.write server.MapPath(uploadpath & "\" & session("file"))
if instr(session("file"),",") then response.Redirect "/CMS_ADMIN_FILES/edit_property.asp?error=illegalchar&unique_ID=" & property_ID & "&Fkey=" & Fkey
old_file = server.MapPath(uploadpath & "\" & session("file"))
file_counter = 1
stop_this_loop = "go"
session.Contents.Remove("file")
do while stop_this_loop = "go"
if file_counter < 10 then
new_file = "0" & file_counter & file_extension
else
new_file = file_counter & file_extension
end if
response.write "<br>" & new_file
If fs.FileExists(server.MapPath(uploadpath & "\" & new_file)) = true Then
file_counter = file_counter + 1
else
stop_this_loop = "stop"
end if
if file_counter < 10 then
new_file = "0" & file_counter & file_extension
else
new_file = file_counter & file_extension
end if
loop
fs.CopyFile old_file,server.MapPath(uploadpath & "\" & new_file)
fs.DeleteFile(old_file)
end if
set fname=nothing
set fs=nothing
' GET THE LAST LARGEST IMAGE ORDER NUMBER AND ADD ONE TO IT
Set order_images = Server.CreateObject("ADODB.Recordset")
order_images.ActiveConnection = CONN_property_search_images
order_images.Source = "SELECT TOP 1 img_order FROM property_images WHERE img_property_ID='" & session("ID") & "' ORDER BY img_order DESC"
order_images.CursorType = 0
order_images.CursorLocation = 2
order_images.LockType = 2
order_images.Open()
if order_images.eof then
new_order_number = 1
else
new_order_number = order_images("img_order") + 1
end if
order_images.close
set order_images = nothing
' NOW STICK IT IN THE DATABASE AND HAVE DONE WITH IT
Set DBCmd_content = Server.CreateObject("ADODB.Command")
DBCmd_content.ActiveConnection = CONN_property_search_images
DBCmd_content.CommandText = "INSERT INTO property_images(img_decription,img_property_ID,img_url,img_order) VALUES('','" & property_ID & "','" & uploadpath & "/" & new_file & "','" & new_order_number & "')"
DBCmd_content.Execute
DBCmd_content.ActiveConnection.Close
response.Redirect "/CMS_ADMIN_FILES/edit_property.asp?action=addok&unique_ID=" & property_ID & "&Fkey=" & Fkey
%>
您需要检查Persits Upload DLL 的注册情况。看这里:
Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed
我在属性网站中内置了一个图片上传器,它工作正常,现在每当我使用图片上传器时,它都会给我一个 500 内部服务器错误消息。
我的错误日志是这样的,有人知道如何理解它告诉我的内容吗?
错误日志文件 - https://pastebin.com/QtenvubM
上传者代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/connection_includes/prop_search_conn_str.asp" -->
<%
Fkey = request.QueryString("Fkey")
property_ID = request.QueryString("property_ID")
uploadpath = "/palm_group/property_images/prop_no_" & property_ID
'------------------------------------------------------------
Set fs=Server.CreateObject("Scripting.FileSystemObject")
If fs.FolderExists(server.MapPath(uploadpath)) = true Then
folder_exists = "yes"
Else
folder_exists = "no"
End If
'response.write uploadpath
'response.write folder_exists
'response.write server.MapPath(uploadpath)
'------------------------------------------------------------
if folder_exists = "no" then
fs.createfolder(server.MapPath(uploadpath))
end if
'-------------------------------------------------------------
Sub ImageUpload()
Server.ScriptTimeout = 555 '[Two Minute Timeout (this will allow upto 2 minutes of activity before ending)]
Set Upload = Server.CreateObject("Persits.Upload")
Count = Upload.Save(Server.MapPath(uploadpath))
For Each File in Upload.Files
LOCAL_LOC = File.Path
REMOTE_LOC = RootDir & replace(file.path, Server.mappath(uploadpath) + "\", "")
FILE_SIZE = File.Size
session("file") = File.filename
Next
Set Upload = Nothing
End Sub
'-------------------------------------------------------------
Call ImageUpload()
'-------------------------------------------------------------
if session("file") = "" then
set fname=nothing
set fs=nothing
response.redirect "/CMS_ADMIN_FILES/edit_property.asp?error=nofile&unique_ID=" & property_ID & "&Fkey=" & Fkey
end if
'-------------------------------------------------------------
file_extension = lcase(right(session("file"),4))
file_is_image = "false"
if file_extension = "jpeg" then file_extension = ".jpg"
if file_extension = ".jpg" then file_is_image = "true"
if file_extension = ".png" then file_is_image = "true"
if file_extension = ".gif" then file_is_image = "true"
if file_is_image <> "true" then
If fs.FileExists(server.MapPath(uploadpath & "\" & session("file"))) = true Then
fs.DeleteFile(server.MapPath(uploadpath & "\" & session("file")))
end if
set fname=nothing
set fs=nothing
response.redirect "/CMS_ADMIN_FILES/edit_property.asp?error=notimage&unique_ID=" & property_ID & "&Fkey=" & Fkey
else
' response.write file_extension
' response.write "<br>"
' response.write server.MapPath(uploadpath & "\" & session("file"))
if instr(session("file"),",") then response.Redirect "/CMS_ADMIN_FILES/edit_property.asp?error=illegalchar&unique_ID=" & property_ID & "&Fkey=" & Fkey
old_file = server.MapPath(uploadpath & "\" & session("file"))
file_counter = 1
stop_this_loop = "go"
session.Contents.Remove("file")
do while stop_this_loop = "go"
if file_counter < 10 then
new_file = "0" & file_counter & file_extension
else
new_file = file_counter & file_extension
end if
response.write "<br>" & new_file
If fs.FileExists(server.MapPath(uploadpath & "\" & new_file)) = true Then
file_counter = file_counter + 1
else
stop_this_loop = "stop"
end if
if file_counter < 10 then
new_file = "0" & file_counter & file_extension
else
new_file = file_counter & file_extension
end if
loop
fs.CopyFile old_file,server.MapPath(uploadpath & "\" & new_file)
fs.DeleteFile(old_file)
end if
set fname=nothing
set fs=nothing
' GET THE LAST LARGEST IMAGE ORDER NUMBER AND ADD ONE TO IT
Set order_images = Server.CreateObject("ADODB.Recordset")
order_images.ActiveConnection = CONN_property_search_images
order_images.Source = "SELECT TOP 1 img_order FROM property_images WHERE img_property_ID='" & session("ID") & "' ORDER BY img_order DESC"
order_images.CursorType = 0
order_images.CursorLocation = 2
order_images.LockType = 2
order_images.Open()
if order_images.eof then
new_order_number = 1
else
new_order_number = order_images("img_order") + 1
end if
order_images.close
set order_images = nothing
' NOW STICK IT IN THE DATABASE AND HAVE DONE WITH IT
Set DBCmd_content = Server.CreateObject("ADODB.Command")
DBCmd_content.ActiveConnection = CONN_property_search_images
DBCmd_content.CommandText = "INSERT INTO property_images(img_decription,img_property_ID,img_url,img_order) VALUES('','" & property_ID & "','" & uploadpath & "/" & new_file & "','" & new_order_number & "')"
DBCmd_content.Execute
DBCmd_content.ActiveConnection.Close
response.Redirect "/CMS_ADMIN_FILES/edit_property.asp?action=addok&unique_ID=" & property_ID & "&Fkey=" & Fkey
%>
您需要检查Persits Upload DLL 的注册情况。看这里:
Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed