On Mon, May 20, 2002 at 08:18:26AM -0700, Scott Chapman wrote: > Gerald, > Thanks for the followup. I have two questions: > > 1) By extra space in the file, you mean outside the [- -] embperl > constructs right? (This can't be there because it will be sent to > the browser which will cause problems, right?)
Yes, extra space outside these blocks is bad. > 2) Don't you have to do something fancy with the http output headers? How > do I tell the browser that a zip file is coming? Something like: [- $http_headers_out{'Content-Type'} = "application/octet-stream"; $http_headers_out{'Content-Length'} = $filesize; # optional $http_headers_out{'Content-Disposition'} = "attachment; filename=$filename"; print OUT stuff while get_stuff_from_file; -] I can't remember if embperl automatically sets the content-length header so you may not need that. If you are using embperl object depending on how you build your pages you may have extraneous spaces in the building blocks of your page output execute sequence. I usually create a subdirectory somewhere and have the most simple base.epl possible (with no extra spaces): [- $req = shift; #maybe do other stuff here# Execute('*'); -] And then have the above snippet as download.epl or whatever. That way you can place all space-sensitive epl files in this subdirectory. > > > I have a <A HREF link that calls a script on the server. The script ends > > up > > > with redirecting the customers browser to the zip file it creates. I want > > the > > > script to send the zip file instead of redirecting the user to the zip > > file (and > > > potentially losing the form changes the link is on). > > > > > > Is there an easy way to use EmbPerl to send the zip file? > > > > > > > That the same like for any other binary file: > > > > [- > > $escmode = 0 ; > > open FH, "filename.zip" ; > > binmode FH ; # only on windows > > while (read(FH, $buffer, 32768)) > > { > > print OUT $buffer ; > > } > > close FH; > > -] > > > > Make sure you don't have any extra spaces/newlines in the page. You could do > > the same with a Apache::Reigstry script to avoid problems with extra space > > in the file > > > > Gerald > > > > > > ------------------------------------------------------------- > > Gerald Richter ecos electronic communication services gmbh > > Internetconnect * Webserver/-design/-datenbanken * Consulting > > > > Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz > > E-Mail: [EMAIL PROTECTED] Voice: +49 6133 925131 > > WWW: http://www.ecos.de Fax: +49 6133 925152 > > ------------------------------------------------------------- > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Andrew O'Brien Senior Engineer email: [EMAIL PROTECTED] Switch Online Group Pty Limited phone: +61 2 9299 1133 ABN 89 092 286 327 fax: +61 2 9299 1134 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]