Newbies Sathish N Posted May 9, 2003 Newbies Posted May 9, 2003 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 %>
Leb i Sol Posted May 9, 2003 Posted May 9, 2003 "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
Leb i Sol Posted May 9, 2003 Posted May 9, 2003 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 is the solution now go get lucky
Newbies Sathish N Posted May 12, 2003 Author Newbies Posted May 12, 2003 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 Sathish N Posted May 12, 2003 Author Newbies Posted May 12, 2003 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
omiossec Posted July 20, 2003 Posted July 20, 2003 The problem can be cause by NTFS that don't allow to search for file outside web server root
Leb i Sol Posted June 1, 2004 Posted June 1, 2004 in that case...define a virtual folder and make it a "part" of the root
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now