myfile.cgi?image.gif saved as myfile.cgi in mozilla?

Discussion in 'Perl Misc' started by joe, Apr 30, 2004.

  1. joe

    joe Guest

    Hi i have a pl file that prints
    print "Content-type: application/octet-stream\n\n";
    and then the output of a file
    in ie it works fine the download.cgi?myzip.zip saves the file as myzip.zip
    in mozilla however i get the wrong file name i get download.cgi
    i tried doing http://www.domain.com/cgi-bin/download.cgi/myzip.zip and i
    get the correct name but the contents dont look right any suggestions?
    thanks.
     
    joe, Apr 30, 2004
    #1
    1. Advertising

  2. Tad McClellan, Apr 30, 2004
    #2
    1. Advertising

  3. joe

    Robin Guest

    "joe" <> wrote in message
    news:Xns94DAC811B1E5Fjosephthecianet@207.69.154.202...
    > Hi i have a pl file that prints
    > print "Content-type: application/octet-stream\n\n";
    > and then the output of a file
    > in ie it works fine the download.cgi?myzip.zip saves the file as myzip.zip
    > in mozilla however i get the wrong file name i get download.cgi
    > i tried doing http://www.domain.com/cgi-bin/download.cgi/myzip.zip and i
    > get the correct name but the contents dont look right any suggestions?
    > thanks.


    check your query string parse code first.
    -Robin
     
    Robin, Apr 30, 2004
    #3
  4. Robin wrote:
    > "joe" <> wrote in message
    >>Hi i have a pl file that prints


    >>in mozilla however i get the wrong file name i get download.cgi
    >>i tried doing http://www.domain.com/cgi-bin/download.cgi/myzip.zip and i

    > check your query string parse code first.

    What query string parse code? The only application doing any query
    parsing for the purposes of this exercise is mozilla, and I doubt that
    you are suggesting he check the source code of that.

    Mark
     
    Mark Clements, Apr 30, 2004
    #4
  5. Robin wrote:

    > "joe" <> wrote in message
    > news:Xns94DAC811B1E5Fjosephthecianet@207.69.154.202...
    >> Hi i have a pl file that prints
    >> print "Content-type: application/octet-stream\n\n";
    >> and then the output of a file
    >> in ie it works fine the download.cgi?myzip.zip saves the file as
    >> myzip.zip in mozilla however i get the wrong file name i get download.cgi
    >> i tried doing http://www.domain.com/cgi-bin/download.cgi/myzip.zip and i
    >> get the correct name but the contents dont look right any suggestions?

    >
    > check your query string parse code first.


    Robin, were you born stupid or do you have to work at it? To begin with, no
    one in their right mind is going to be using their own parsing code.
    Second, query string parsing doesn't have *one* *damn* *thing* to do with
    this problem.

    Joe, in theory what you need is to return a Content-Disposition header as
    part of your response. It appears to have some problems in practice though.
    See this page for discussion:

    <http://www.hanselman.com/blog/PermaLink.aspx?guid=360>

    And these are the relevant standards docs:

    <http://www.faqs.org/rfcs/rfc1806.html>
    <http://www.faqs.org/rfcs/rfc2183.html>

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
     
    Sherm Pendley, Apr 30, 2004
    #5
  6. On Fri, 30 Apr 2004, Sherm Pendley wrote:

    > Robin wrote:
    >
    > > check your query string parse code first.

    >
    > Robin, were you born stupid or do you have to work at it?


    Please resist the temptation to feed the trolls.
     
    Alan J. Flavell, Apr 30, 2004
    #6
  7. joe

    Joe Smith Guest

    Peter Payne wrote:

    > my $s_buffer = undef;
    > while ( read( EXECGZIP, $s_buffer, 1024 ) )
    > {
    > print( $s_buffer );
    > }


    You need to put
    binmode STDOUT;
    in front of that loop.
    -Joe
     
    Joe Smith, Apr 30, 2004
    #7
  8. joe

    Joseph Guest

    I found this a couple of days ago.
    print "Content-disposition: attachment; filename=$filename\n";
    print "Content-type: application/x-download\n\n";

    so far it its working in both mozilla and i, with this headers i dont
    have to specify file type. thanks for the tips
     
    Joseph, May 12, 2004
    #8
    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. hb
    Replies:
    6
    Views:
    9,186
  2. Sharron
    Replies:
    1
    Views:
    837
    Thomas Matthews
    Aug 19, 2003
  3. gbattine
    Replies:
    0
    Views:
    3,153
    gbattine
    Jun 6, 2006
  4. Beauregard T. Shagnasty

    Re: filename.gif or filename.gif.jpg?

    Beauregard T. Shagnasty, May 30, 2008, in forum: HTML
    Replies:
    1
    Views:
    793
    Jonathan N. Little
    May 30, 2008
  5. Bergamot
    Replies:
    0
    Views:
    474
    Bergamot
    May 30, 2008
Loading...

Share This Page