x-mixed-replace

Discussion in 'Perl Misc' started by David Walker, Feb 11, 2007.

  1. David Walker

    David Walker Guest

    Hi,

    I am trying to upload a file to a web server, process it with a Perl script
    and then return the following to the client:
    1) A summary of the processing
    2) a gzipped tar file of the processed data.

    I had thought that the following should work:

    print "Content-type: multipart/x-mixed-replace;boundary=frontier\n";
    print "\n--frontier\n";
    print "Content-type: text/html\n\n";
    print "<HTML><BODY>Here is the summary!</BODY></HTML>";
    print "\n--frontier\n";
    print "Content-Type: application/x-tgz; name=$archive\n";
    print "Content-Transfer-Encoding: base64\n";
    print "Content-Disposition: inline; filename=$archive\n\n";
    $gz = gzopen(\*STDOUT, "wb") or die "Cannot open stdout: $gzerrno\n" ;
    $gz->gzwrite($bigbuf);
    $gz->gzclose;
    print "\n--frontier--\n";

    But the above produces the HTML page with the gzipped tar file added on to
    the end. What I want to happen is for the HTML page to be displayed, and
    then the gzipped tar file to be intercepted by the browser to be saved. If I
    miss out the first 5 lines, and the last line, of the above code then I get
    the gzipped tar file OK and can save it, so that part works OK by itself..
    Perhaps I have simply misunderstood what x-mixed-replace is supposed to do.
    Any help would be appreciated.

    Regards
    David
     
    David Walker, Feb 11, 2007
    #1
    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. Brian Blais
    Replies:
    1
    Views:
    394
    Bruno Desthuilliers
    Jun 27, 2006
  2. Greg Ewing
    Replies:
    2
    Views:
    357
    Dieter Maurer
    Jun 29, 2006
  3. Alun
    Replies:
    3
    Views:
    4,570
    Masudur
    Feb 18, 2008
  4. Prasad S
    Replies:
    2
    Views:
    245
    Dr John Stockton
    Aug 27, 2004
  5. Wilfred Nilsen
    Replies:
    3
    Views:
    310
    Martin Honnen
    May 1, 2005
Loading...

Share This Page