Display Large Images

Discussion in 'ASP General' started by cnote, Jul 26, 2006.

  1. cnote

    cnote Guest

    I am trying to upload large images ( around 4 mb) from the server to show on
    the client. Currently I'm using an http handler to do it and breaking it
    into chunks sending it 1 mb at a time. Sometimes I'm getting errors, like
    the page won't load. Any solutions on how this is done right? Thanks for
    your help.
    cnote, Jul 26, 2006
    #1
    1. Advertising

  2. cnote wrote:
    > I am trying to upload large images ( around 4 mb) from the server to
    > show on the client. Currently I'm using an http handler to do it and
    > breaking it into chunks sending it 1 mb at a time. Sometimes I'm
    > getting errors, like the page won't load. Any solutions on how this
    > is done right? Thanks for your help.


    "http handler"?
    Is this a classic asp or asp.net question?
    If the latter:
    There was no way for you to know it (except maybe by browsing through some
    of the previous questions before posting yours - always a recommended
    practice) , but this is a classic asp newsgroup. ASP.Net bears very little
    resemblance to classic ASP so,
    while you may be lucky enough to find a dotnet-knowledgeable person here who
    can answer your question, you can eliminate the luck factor by posting your
    question to a group where those dotnet-knowledgeable people hang out. I
    suggest microsoft.public.dotnet.framework.aspnet.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jul 26, 2006
    #2
    1. Advertising

  3. cnote

    Wade Guest

    This worked for me (I was running into the 4MB ceiling too) (Thanks to
    Jason Withrow's contribution to ASP101
    which helped me get started on downloading files)

    Response.Buffer = True 'I didn't try "False"
    Const BufSize = 2097152 '2MB "chunk"
    Dim i
    Dim objstream
    Set objStream = Server.CreateObject("ADODB.Stream")
    objStream.Open
    objStream.Type = adTypeBinary
    objStream.LoadFromFile strFilePath
    strFileType = lcase(Right(strFileName, 4))

    ' Feel Free to Add Your Own Content-Types Here
    Select Case strFileType
    Case ".doc"
    ContentType = "application/msword"
    Case ".jpg", "jpeg"
    ContentType = "image/jpeg"
    :
    : 'other cases
    :
    Case Else
    ContentType = "application/octet-stream"

    End Select
    Response.Charset = "UTF-8"
    Response.ContentType = ContentType
    i = 1
    Response.BinaryWrite objStream.Read(BufSize)

    Response.Flush
    while not objstream.EOS
    objstream.Position = (BufSize * i)
    Response.BinaryWrite objstream.Read(BufSize)
    Response.flush
    i = i + 1
    wend
    objStream.Close
    Set objStream = Nothing




    "cnote" <> wrote in message
    news:...
    >I am trying to upload large images ( around 4 mb) from the server to show
    >on
    > the client. Currently I'm using an http handler to do it and breaking it
    > into chunks sending it 1 mb at a time. Sometimes I'm getting errors, like
    > the page won't load. Any solutions on how this is done right? Thanks for
    > your help.
    >
    >
    Wade, Aug 1, 2006
    #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. moondaddy
    Replies:
    4
    Views:
    763
    S. Justin Gengo
    Jun 29, 2004
  2. ilano

    Fast display of large images

    ilano, Oct 5, 2007, in forum: Java
    Replies:
    1
    Views:
    342
    Roedy Green
    Oct 9, 2007
  3. ilano

    Fast display of large images

    ilano, Oct 5, 2007, in forum: Java
    Replies:
    9
    Views:
    367
    ilano
    Oct 9, 2007
  4. Ketchup
    Replies:
    1
    Views:
    239
    Jan Tielens
    May 25, 2004
  5. Replies:
    5
    Views:
    868
    Xho Jingleheimerschmidt
    Apr 2, 2009
Loading...

Share This Page