[REBOL] Re: Sending a PDF to Browser
From: andrew::martin::colenso::school::nz at: 15-Sep-2003 10:24
DJ wrote:
> print read/binary %file.pdf
That's wrong. You have to send the file contents as binary. Some thing
like this:
MIME: make object! [
Extension_MIME: load %"Extension MIME.txt"
Type?: func [File [file!]] [
select Extension_MIME Extension? File
]
Data: function [File [file!]] [Data] [
Data: read/binary File
print [
"Content-Type:" any [
Type? File
'application/octet-stream
]
newline
]
write-io system/ports/output Data length? Data
Data: none
quit
]
]
MIME/Data File
If you'd like a copy of my %"Extension MIME.txt", email me directly at:
andrew.martin at colenso.school.nz
Andrew J Martin
Attendance Officer &
Information Systems Trouble Shooter
Colenso High School
Arnold Street, Napier.
Tel: 64-6-8310180 ext 826
Fax: 64-6-8336759
http://colenso.net/scripts/Wiki.r?AJM
http://www.colenso.school.nz/
DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally
liable) for materials distributed to or acquired from user e-mail accounts. You can report
any
misuse of an e-mail account to our ICT Manager and the complaint will be investigated.
(Misuse can come in many forms, but can be viewed as any material sent/received that
indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate
language and/or other issues described in our Acceptable Use Policy.)
All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0
Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]