<% 'This web service just try to search in the IOPI Database if a name is allready on it or not. 'If its there send a green button, if not send a red button. if Request("NameCache")<>"" then name=Request("NameCache") namearray=SPlit(name," ") if ubound(namearray)>0 then namecache=namearray(0)& " " & namearray(1) & "%" else namecache=name end if SQL="SELECT FullNameCache FROM Name INNER JOIN PTaxon ON NameId = PTNameFk WHERE FullNameCache LIKE '"& Replace(namecache,"'","''") &"'" Set Rspecie = Server.CreateObject("ADODB.Recordset") Rspecie.ActiveConnection = MM_jun_STRING Rspecie.Source = SQL Rspecie.CursorType = 3 Rspecie.CursorLocation = 2 Rspecie.LockType = 1 Rspecie.Open() if Rspecie.Recordcount > 0 then 'This name exists in the database and has a potential taxon using it. 'We have to resturn the gree button file_to_use="iopileaf_little.gif" else 'This name doesnt't exist in the database 'We have to return the red button file_to_use="iopileaf_empty.gif" end if Rspecie.close set Rspecie=Nothing else 'There's no name to search for 'We have to return the red button file_to_use="red.gif" end if %> <% PathTo = Server.MapPath("images/"&file_to_use) FileNameOf = Mid(PathTo, (InStrRev(PathTo, "\") + 1), Len(PathTo)) FileEXT = Mid(PathTo, InStrRev(PathTo, "."), Len(PathTo)) BlockOf = 100000 CountOf = 0 ContentTypeOf = "image/GIF" '------------------------------------------------- 'Get File Size------------------------------------ Set fso = CreateObject("Scripting.FileSystemObject") Set fileObject = fso.GetFile(PathTo) SizeOf = fileObject.Size '------------------------------------------------- 'Header and Cache--------------------------------- Response.Expires = 0 Response.Buffer = True Response.Clear Response.ContentType = ContentTypeOf Response.AddHeader "content-disposition", "attachment; filename=" & FileNameOf Response.AddHeader "Content-Length", SizeOf Response.CharSet = "UTF-8" Response.Flush '------------------------------------------------- 'Open Adodb stream to get chunks of file---------- Set BinaryStream = Server.CreateObject("ADODB.Stream") BinaryStream.Open BinaryStream.Type = 1 BinaryStream.LoadFromFile(PathTo) '------------------------------------------------- 'Loop through blocks of data and send------------- While SizeOf > BlockOf + CountOf CountOf = CountOf + BlockOf Response.BinaryWrite BinaryStream.Read(BlockOf) Response.Flush Wend '------------------------------------------------- 'Read Last Block of bytes and send---------------- Response.BinaryWrite BinaryStream.Read(SizeOf - CountOf) Response.Flush Response.End '------------------------------------------------- 'Set to Nothing-------------- Set BinaryStream = Nothing Set fso = Nothing '---------------------------- %>