Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7478 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Hi All,

I am using the following code in my ASP page to read a image and display it. In my code first i am reading the binary content of the image that is saved in the database and then converting it to a string using "RSBinaryToString" function, finally appending the string content to that blank image. Then i am planning to display in my ASP page. This works perfectly when i do in Windows 98(PWS), but when i try the same in Windows 2000(IIS) the image is not created properly. What is the problem, what code change should i do to make it work in Windows 2000 system also, or is there is any alternative for this?. Plz treat this as urgent. For u'r information i am using filemaker pro database.

<%

Dim oConn

Dim RS

Dim Pic

Dim PicSize

Dim btArr

Dim fstemp

Dim filetemp

dim filename

Dim strSQL

set oConn = Server.CreateObject("ADODB.Connection")

oConn.open "test"

set RS = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT * FROM test"

RS.Open strSQL,oConn

PicSize = RS("Image").ActualSize

Pic = RS("Image").GetChunk(PicSize)

' Note we need to convert the Byte Array data back to a String

btArr = RSBinaryToString(Pic)

Set fstemp = CreateObject("Scripting.FileSystemObject")

Set filetemp = fstemp.CreateTextFile("C:Signature.jpg", true)

filetemp.write( btArr)

filetemp.Close %>

<%Function RSBinaryToString(xBinary)

Dim Binary

If VarType(xBinary)=8 Then Binary = MultiByteToBinary(xBinary) Else Binary = xBinary

Dim RS, LBinary

Const adLongVarChar = 201

Set RS = CreateObject("ADODB.Recordset")

LBinary = LenB(Binary)

If LBinary>0 Then

RS.Fields.Append "mBinary", adLongVarChar, LBinary

RS.Open

RS.AddNew

RS("mBinary").AppendChunk Binary

RS.Update

RSBinaryToString = RS("mBinary")

Set RS=Nothing

Else

RSBinaryToString = ""

End If

Set RS=Nothing

End Function

Function MultiByteToBinary(MultiByte)

Dim RS, LMultiByte, Binary

Const adLongVarBinary = 205

Set RS = CreateObject("ADODB.Recordset")

LMultiByte = LenB(MultiByte)

If LMultiByte>0 Then

RS.Fields.Append "mBinary", adLongVarBinary, LMultiByte

RS.Open

RS.AddNew

RS("mBinary").AppendChunk MultiByte & ChrB(0)

RS.Update

Binary = RS("mBinary").GetChunk(LMultiByte)

End If

Set RS = Nothing

MultiByteToBinary = Binary

End Function

%>

Posted

"This works perfectly when i do in Windows 98(PWS), but when i try the same in Windows 2000(IIS) the image is not created properly"

I have seen this before...IE 6 and.or Firewall on the Win2000 platform?

Make sure you have the working VM for Java...

also look into "Anable HTTP alives" or somemthing like that...in IIS admin/mamanger -->Rightclick--->Properties-->General Tab there should be an option.

good luck

Posted

also without creating any panic check for Nimda....most commonly you will see an unknown user & its rights assigned to your root folder...username is displayed as ?12-3&^*%32@5 or any random string as a name!

IF this is the case...and I hope not...then get the Nimda Removal Tool & IF it does not clean up the virus...then

Format C: Y frown.gif is the solution

now go get lucky laugh.gif

  • Newbies
Posted

Hi Leb i Sol,

Thanks for your kind reply. I tried your suggestions, still it is creating a blank image in IIS. What else i have to do to make it work?. Thanks in advance.

  • Newbies
Posted

In windows 2000 the content of the image file looks something like this, after i have created.

===================================================

HTTP/1.0 200 OK

Date: Mon, 12 May 2003 12:05:30 GMT

Server: FileMakerPro/5.5

MIME-Version: 1.0

Content-type: image/jpeg

Content-length: 24199

  • 3 weeks later...
  • 1 month later...
  • 10 months later...

This topic is 7478 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.