Help with getting a jpeg to download on Mac IE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sam Felsenfeld

    Help with getting a jpeg to download on Mac IE

    Thanks in advance to anyone who can help me ...
    I have a link on a page that allows people to automatically download a jpeg.
    The link basically goes to "download.jpg?p ic=filename"

    Here's what I have in my download.php file:

    $pic=$_GET['pic'];
    $file="lg/"."$pic";
    $name="$pic";
    $fp=fopen($file , "r");
    header("content-disposition: filename=\"$nam e\"");
    header("content-type: attachment; name=\"$name\"" );
    fpassthru($fp);
    exit;

    It works fine on everything I've tried on a PC, plus it works fine on Safari
    and Netscape on a Mac, but it doesn't work on IE on a Mac, either on 9.x or
    OS X. Anybody know why?

    Thanks,
    Sam

  • John Dunlop

    #2
    Re: Help with getting a jpeg to download on Mac IE

    Sam Felsenfeld wrote:
    [color=blue]
    > header("content-type: attachment; name=\"$name\"" );[/color]

    What made you mess with the Content-Type?

    --
    Jock

    Comment

    • Sam Felsenfeld

      #3
      Re: Help with getting a jpeg to download on Mac IE

      I don't do much with PHP outside of databases, so this is new to me. I
      looked through everything I have, then looked all over the web for answers,
      and this was the closest thing I could find to work as a solution.

      I'm guessing this is something that's pretty simple for most everybody else
      .... Is that where I'm going wrong?

      On 5/29/04 2:43 AM, in article
      MPG.1b226bb4852 233c7989726@New s.Individual.NE T, "John Dunlop"
      <usenet+2004@jo hn.dunlop.name> wrote:
      [color=blue]
      > Sam Felsenfeld wrote:
      >[color=green]
      >> header("content-type: attachment; name=\"$name\"" );[/color]
      >
      > What made you mess with the Content-Type?[/color]

      Comment

      • John Dunlop

        #4
        Re: Help with getting a jpeg to download on Mac IE

        Sam Felsenfeld wrote upside-down:
        [color=blue][color=green]
        > > Sam Felsenfeld wrote:
        > >[color=darkred]
        > > > header("content-type: attachment; name=\"$name\"" );[/color][/color][/color]

        [ ... ]
        [color=blue]
        > ... Is that where I'm going wrong?[/color]

        The Content-Type header? Yes. For a JPEG, the registered media type
        is image/jpeg, which the Content-Type header should reflect. Your
        Content-Type header isn't just meaningless, but syntactically
        malformed (RFC2616, secs. 14.17 and 3.7).

        Just link to the image. Most web servers will take care of sending
        appropriate headers for you.

        --
        Jock

        Comment

        • Sam Felsenfeld

          #5
          Re: Help with getting a jpeg to download on Mac IE

          Sorry to go back and forth so much on this, but I do appreciate your
          willingness to help ...

          I think you're misunderstandin g what I need to accomplish ... I need the
          user to click on a link, and when they click on that link, I need it to
          automatically begin a download of a jpeg to their computer. I screwed up
          when I originally posted and those two header lines are flip-flopped, but
          aside from that, that script is working in everything other than IE on a
          Mac. Is there a simple way/function to automatically force a download of a
          jpeg? Just linking to the image is going to open it in the browser.

          Thanks,
          Sam

          On 5/29/04 8:44 AM, in article
          MPG.1b22c02dcba 80b3398972a@New s.Individual.NE T, "John Dunlop"
          <usenet+2004@jo hn.dunlop.name> wrote:
          [color=blue]
          > Sam Felsenfeld wrote upside-down:
          >[color=green][color=darkred]
          >>> Sam Felsenfeld wrote:
          >>>
          >>>> header("content-type: attachment; name=\"$name\"" );[/color][/color]
          >
          > [ ... ]
          >[color=green]
          >> ... Is that where I'm going wrong?[/color]
          >
          > The Content-Type header? Yes. For a JPEG, the registered media type
          > is image/jpeg, which the Content-Type header should reflect. Your
          > Content-Type header isn't just meaningless, but syntactically
          > malformed (RFC2616, secs. 14.17 and 3.7).
          >
          > Just link to the image. Most web servers will take care of sending
          > appropriate headers for you.[/color]

          Comment

          • Joel Farris

            #6
            Re: Help with getting a jpeg to download on Mac IE

            Sam Felsenfeld wrote:
            [color=blue]
            > I think you're misunderstandin g what I need to accomplish ... I need the user
            > to click on a link, and when they click on that link, I need it to
            > automatically begin a download of a jpeg to their computer.[snip]that script
            > is working in everything other than IE on a Mac. Is there a simple
            > way/function to automatically force a download of a jpeg? Just linking to the
            > image is going to open it in the browser.
            >
            > Thanks, Sam[/color]


            If it works in every other browser you've tried, including Safari, I'd start
            looking at what's messed up in IE's 'file helpers' preferences.
            --
            Joel Farris | Q: It reverses the logical flow of conversation.
            twinkledust Designs | A: Why is top posting frowned upon?
            http://twinkledust.com |
            AIM chat: FarrisJoel | "John Kerry: A walking, talking contradiction"

            Comment

            • John Dunlop

              #7
              Re: Help with getting a jpeg to download on Mac IE

              Sam Felsenfeld wrote upside-down:
              [color=blue]
              > Is there a simple way/function to automatically force a download of a
              > jpeg?[/color]

              Nope. Sorry to disappoint, but there's no complicated way either.
              That's not how the web works.
              [color=blue]
              > Just linking to the image is going to open it in the browser.[/color]

              If you truly believe that, I'd urge you to read some WWW authoring
              group.

              --
              Jock

              Comment

              Working...