Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Binary Image Stream

Posted on 2004-10-27
Medium Priority
Last Modified: 2010-05-18
I have images that are stored on my network.  The servers that the images are stored on are not accessible via http. So I have a user account created and am using impersonation to get to the directory on this server which holds the images.

I have to Binary stream these images to get them onto the web browser and I can't use a 3rd party component. I have to do it all in ASP.

Any ideas as to how I can do this?

Question by:Lantrax
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3

Author Comment

ID: 12422523
I can also use FSO but i am not sure how to get that to work with impersonation. the directory is somthing like this:


Is there any way that i can do this. Either Binary Streaming or FSO or anything..

LVL 28

Accepted Solution

sybe earned 200 total points
ID: 12422726
Sub WriteFileToBrowser(ByVal sFilePath, ByVal sContentType, ByVal sDisplayName)
    Dim oStream
    Set oStream = Server.CreateObject("ADODB.Stream")
    oStream.Type = 1
    oStream.LoadFromFile sFilePath
    Response.ContentType = sContentType
    Response.AddHeader "Content-Disposition", "filename=" & sDisplayName
    Response.AddHeader "Content-Length", oStream.Size
    Response.BinaryWrite oStream.Read
    Set oStream = Nothing
End Sub

Author Comment

ID: 12422754
I don;t mean to be ignorant but i am.... LOL..

what is sContentType and sDisplayname?

I am confused on those. Also how will i get this to work in classic asp. can i just convert it into a function?

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 12422763
also i am using imnpersonation. Do i set anything here for that?
LVL 28

Expert Comment

ID: 12422789
* sContenttype should be something like "image/gif" or "text/plain" or whatever the MIME-type of the document is
* sDisplayname should be something like "myimage.gif" or "documentname.doc". When you stream the file to the browser using an ASP, and the user wants to save it, then that will be the default name. Otherwise the defaultname would be the name of the ASP file which is doing the job of streaming the file to the browser.

Author Comment

ID: 12423006
I am streaming an image. Is there a way that i can get teh dimentions and then resize the image on the fly without resizing it on the server but just on the display for the browser?


Author Comment

ID: 12423024
Darn... I can't get the File straem to work because i have to implement impersonation. Do you know how that is done using this object?
LVL 28

Expert Comment

ID: 12423051
that's a completely other question.

1. getting the dimensions means you have to look inside the binary code of the image. I have seen code like that somewhere, try to google it.
2. resizing on the client is easy: <image src="yourstreamingpage.asp" width="50%" height="50%">

Author Comment

ID: 12423475
Do you know why i would get this error.

ADODB.Stream error '800a0bba'

File could not be opened.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question