Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > x-mixed-replace

Thread Tools


David Walker
Posts: n/a

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" ;
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.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off