How do I read a jpeg image from a folder on a server

Discussion in 'ASP .Net Web Controls' started by Lucas Cowald, Oct 11, 2003.

  1. Lucas Cowald

    Lucas Cowald Guest

    Hi,

    How do I read a jpeg image from a folder on a server, and give it to a user
    as a file that his browser would download it (stream it) directly without
    sending any HTML tags.

    Here is exactly why I need it:

    1) User goes to a page image.asp
    2) image.asp would connect to a database and check, if this user has already
    downloaded the image before.
    3) If the user has never downloaded the image, he will be able to
    downloaded, If user has already downloaded the image before, a text will
    show on his browser that he can't get it the second time.

    What is the best way to acomplish this. Can you show a sample code in
    VBscript/ASP?

    Thank you in advance for your help.
     
    Lucas Cowald, Oct 11, 2003
    #1
    1. Advertising

  2. A common way of dynamically sending images to a client is to load the image
    into a stream, set the response object mime type and then write the image
    data to the response stream. This is documented in:

    HOW TO: Write Binary Files to the Browser Using ASP.NET and Visual C# .NET
    http://support.microsoft.com/?id=306654

    You should be able to layer the database check around this concept.

    Chris Marchal
    Microsoft UK Developer Support
    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Chris Marchal[MSFT], Oct 14, 2003
    #2
    1. Advertising

  3. Lucas Cowald

    Lucas Cowald Guest

    Hi Chris,

    Thanks for your reply!
    The problem is that the images are not stored in the database. They are
    stored in folders as JPEGs. I only store the location of each image in the
    database.

    Is there a command in VBScript/ASP that would convert JPEG image into a
    binary format (right in the ASP script) without the need for the image to
    come out from the database?

    Thank you,
    Lucas
    "Chris Marchal[MSFT]" <> wrote in message
    news:...
    > A common way of dynamically sending images to a client is to load the

    image
    > into a stream, set the response object mime type and then write the image
    > data to the response stream. This is documented in:
    >
    > HOW TO: Write Binary Files to the Browser Using ASP.NET and Visual C# .NET
    > http://support.microsoft.com/?id=306654
    >
    > You should be able to layer the database check around this concept.
    >
    > Chris Marchal
    > Microsoft UK Developer Support
    > This posting is provided "AS IS" with no warranties, and confers no

    rights.
    >
    >
    >
     
    Lucas Cowald, Oct 15, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Speed
    Replies:
    12
    Views:
    1,131
  2. Speed
    Replies:
    10
    Views:
    1,205
    Kelsey Bjarnason
    Jul 30, 2007
  3. lovaspillando
    Replies:
    0
    Views:
    1,039
    lovaspillando
    Aug 26, 2007
  4. Ivan Alameda Carballo
    Replies:
    0
    Views:
    501
    Ivan Alameda Carballo
    Aug 26, 2007
  5. Lucas Cowald

    How do I read a jpeg image from a folder on a server

    Lucas Cowald, Oct 11, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    158
    Lucas Cowald
    Oct 11, 2003
Loading...

Share This Page