Announcement

Collapse
No announcement yet.

changing "content-type" output of hs webserver

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    changing "content-type" output of hs webserver

    So, how do you get homeseer to not output:

    Content-Type: text/html

    I want to output a jpeg image via an asp page... and i can't output

    Content-Type: image/jpeg

    because no matter what output is sent to the browser, homeseer always puts its own custom Content-Type of "text/html" in front of the data.

    Is this possible?

    #2
    Originally posted by polive96
    So, how do you get homeseer to not output:

    Content-Type: text/html

    I want to output a jpeg image via an asp page... and i can't output

    Content-Type: image/jpeg

    because no matter what output is sent to the browser, homeseer always puts its own custom Content-Type of "text/html" in front of the data.

    Is this possible?
    How exactly are you trying to do this? In an asp page, aspx page?
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      in a standard asp page served by homeseer

      here's the code

      PHP Code:
      <%@ Language=VBScript %>
      <%
          
      Dim sampleimagesampleimage hs.getAppPath "test.jpg"
          
          
      if (Right(Request.Form("image"), 3) = "jpg"then
              downloadFile
      (Request.Form("image"))
          else
              
      downloadFile(sampleimage)
          
      end if

          function 
      downloadFile(strFile)
              
      ' get full path of specified file
              strFilename = server.MapPath(strFile)
              ' 
      create stream
              Set s 
      CreateObject("ADODB.Stream")
              
      s.Open
              
      ' set as binary
              s.Type = 1
              ' 
      load in the file
              on error resume next
              
      ' check the file exists
              Set fso = CreateObject("Scripting.FileSystemObject")
              if not fso.FileExists(strFilename) then
                  Response.Write("<h1>Error:</h1>" & strFilename & " does not exist<p>")
                  Response.End
              end if
              ' 
      get length of file
              Set f 
      fso.GetFile(strFilename)
              
      intFilelength f.size
              
      'load file
              s.LoadFromFile(strFilename)
              if err then
                  Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
                  Response.End
              end if
              ' 
      output the file to the browser
              Response
      .ContentType "image/jpeg"
              
      Response.BinaryWrite s.Read
              Response
      .End
              
      ' tidy up
              s.Close
              Set s = Nothing
          end function
      %> 
      Last edited by Rupp; December 29, 2005, 12:25 PM.

      Comment


        #4
        Is this with HS 1.7? If so the 1.7 web server is not fully asp compliant. If it's with HS 2.0 then I would put in a trouble ticket.
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #5
          i'm wanting this to work on 1.7 and 2.0... plus even if it's not asp compliant... it would be nice to be able to only send out what you want sent.

          Comment

          Working...
          X