HTML quick question

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

ghostman

Golden Member
Jul 12, 2000
1,819
1
76
Can you use perl on that server? If so, try the following code. I tested it with a doc file and it worked perfectly. test.doc was my file. I placed it in the same location as my script, but I think you can place it elsewhere.

==========================
#!/usr/local/bin/perl

$binary = "test.doc";
$size = -s "$binary";

open(DOWNLOAD,&quot;<$binary&quot;) or die $!;

#print &quot;Content-Type:application/octet-stream\n&quot;;
print &quot;Content-Type:application/msword\n&quot;;
print &quot;Content-Disposition:attachment; filename=test.doc\n&quot;;
print &quot;Content-Length:$size\n\n&quot;;binmode(DOWNLOAD);binmode(STDOUT);

while(read DOWNLOAD, $buffer, 1){ print $buffer; }

close(DOWNLOAD);
============================
found on comp.lang.perl.misc
 

DAM

Diamond Member
Jan 10, 2000
6,102
1
76


<< Can you use perl on that server? If so, try the following code. I tested it with a doc file and it worked perfectly. test.doc was my file. I placed it in the same location as my script, but I think you can place it elsewhere.

==========================

found on comp.lang.perl.misc
>>




Hmm, its ain IIS 5.0 (win2k adv server) never tried perl in it. So I do not know. damn I will see what I can do, but thanks for the code. Know any ASP :--)



dam()