C
Christopher Brandsdal
Hi!
I get an error when I run my code
Is there any other way to get te information from my form?
Heres the error I get and the code beneath.
Line 120 is market with ''''''''''''Line 120'''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''CODE'''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Request object error 'ASP 0207 : 80004005'
Cannot use Request.Form
/asp/admin/select_image.asp, line 120
Cannot use Request.Form collection after calling BinaryRead.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''CODE'''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
if Request.QueryString("action") = "upload" then
Server.ScriptTimeout = 1200
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
ByteCount = Request.TotalBytes
if ByteCount > Application("MaxFileSize2Upload") then
Response.Redirect "./select_image.asp?error=05"
end if
RequestBin = Request.BinaryRead(byteCount)
BuildUploadRequest RequestBin
Dim aux, aux1
Dim ImageCateg, ContentType, FilePathName, FileName, Value
ImageCateg = Unescape(UploadRequest.Item("inpcatid").Item("Value")) 'Image
Folder
on error resume next
ContentType = UploadRequest.Item("inpFile").Item("ContentType")
FILEFLAG = err.number
on error goto 0
if FILEFLAG = 0 then
ContentType = UploadRequest.Item("inpFile").Item("ContentType")
FilePathName = UploadRequest.Item("inpFile").Item("FileName")
FileName =
Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
Value = UploadRequest.Item("inpFile").Item("Value")
else
FileName = ""
end if
Dim objFSO2
Dim objFSO3
Dim objUploadFile
Dim objDelFile1
Dim OldPath
'''''''''''''''laster opp bilde'''''''''''''''''''''''''''''
if FileName<>"" then
on error resume next
Set objFSO2 = Server.CreateObject("Scripting.FileSystemObject")
Set objUploadFile = objFSO2.CreateTextFile(ImageCateg&"\"&FileName)
objUploadFile.Write getString(value)
objUploadFile.Close
FILEFLAG = err.number
on error goto 0
'''''''''''''''resizer bilde'''''''''''''''''''''''''''''
' create instance of AspJpeg object
Set jpeg = Server.CreateObject("Persits.Jpeg")
' open uploaded file
Dim ResizeName
Dim Ratio
OldPath = Server.MapPath(Escape(sDir) & Escape(FileName))
jpeg.Open( OldPath )
' resize image accoring to "scale" option.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''Line
120'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''
Select Case Request.Form("resize")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''/Line
120/''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''
Case "tn"
ResizeName = "_miniatyr"
Ratio = jpeg.OriginalHeight / 100
jpeg.Width = 100
jpeg.Height = jpeg.OriginalHeight / Ratio
Case Else
ResizeName = "_noko_anna"
jpeg.Width = jpeg.OriginalWidth * 50 / 100
jpeg.Height = jpeg.OriginalHeight * 50 / 100
End Select
OldPath = Server.MapPath(Escape(sDir)) & "\" & Escape(FileName)
SavePath = Left(OldPath, InStrRev(OldPath, ".") - 1)
SavePath = SavePath & ResizeName
SavePath = SavePath & ".jpg"
Jpeg.Interpolation = 2
'AspJpeg always generates JPEG thumbnails regardless of original format.
'If the original file was not a JPEG, append .JPG extension.
jpeg.Save SavePath
end if
Set objFSO2 = nothing
Set objUploadFile = nothing
Set UploadRequest = nothing
I get an error when I run my code
Is there any other way to get te information from my form?
Heres the error I get and the code beneath.
Line 120 is market with ''''''''''''Line 120'''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''CODE'''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Request object error 'ASP 0207 : 80004005'
Cannot use Request.Form
/asp/admin/select_image.asp, line 120
Cannot use Request.Form collection after calling BinaryRead.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''CODE'''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
if Request.QueryString("action") = "upload" then
Server.ScriptTimeout = 1200
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
ByteCount = Request.TotalBytes
if ByteCount > Application("MaxFileSize2Upload") then
Response.Redirect "./select_image.asp?error=05"
end if
RequestBin = Request.BinaryRead(byteCount)
BuildUploadRequest RequestBin
Dim aux, aux1
Dim ImageCateg, ContentType, FilePathName, FileName, Value
ImageCateg = Unescape(UploadRequest.Item("inpcatid").Item("Value")) 'Image
Folder
on error resume next
ContentType = UploadRequest.Item("inpFile").Item("ContentType")
FILEFLAG = err.number
on error goto 0
if FILEFLAG = 0 then
ContentType = UploadRequest.Item("inpFile").Item("ContentType")
FilePathName = UploadRequest.Item("inpFile").Item("FileName")
FileName =
Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
Value = UploadRequest.Item("inpFile").Item("Value")
else
FileName = ""
end if
Dim objFSO2
Dim objFSO3
Dim objUploadFile
Dim objDelFile1
Dim OldPath
'''''''''''''''laster opp bilde'''''''''''''''''''''''''''''
if FileName<>"" then
on error resume next
Set objFSO2 = Server.CreateObject("Scripting.FileSystemObject")
Set objUploadFile = objFSO2.CreateTextFile(ImageCateg&"\"&FileName)
objUploadFile.Write getString(value)
objUploadFile.Close
FILEFLAG = err.number
on error goto 0
'''''''''''''''resizer bilde'''''''''''''''''''''''''''''
' create instance of AspJpeg object
Set jpeg = Server.CreateObject("Persits.Jpeg")
' open uploaded file
Dim ResizeName
Dim Ratio
OldPath = Server.MapPath(Escape(sDir) & Escape(FileName))
jpeg.Open( OldPath )
' resize image accoring to "scale" option.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''Line
120'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''
Select Case Request.Form("resize")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''/Line
120/''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''
Case "tn"
ResizeName = "_miniatyr"
Ratio = jpeg.OriginalHeight / 100
jpeg.Width = 100
jpeg.Height = jpeg.OriginalHeight / Ratio
Case Else
ResizeName = "_noko_anna"
jpeg.Width = jpeg.OriginalWidth * 50 / 100
jpeg.Height = jpeg.OriginalHeight * 50 / 100
End Select
OldPath = Server.MapPath(Escape(sDir)) & "\" & Escape(FileName)
SavePath = Left(OldPath, InStrRev(OldPath, ".") - 1)
SavePath = SavePath & ResizeName
SavePath = SavePath & ".jpg"
Jpeg.Interpolation = 2
'AspJpeg always generates JPEG thumbnails regardless of original format.
'If the original file was not a JPEG, append .JPG extension.
jpeg.Save SavePath
end if
Set objFSO2 = nothing
Set objUploadFile = nothing
Set UploadRequest = nothing