D
David Walker
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
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