Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

cgi binary data xfer...

 [1/6] from: maximo::meteorstudios::com at: 16-Sep-2003 13:32


hi all, I was wondering how I can provide a link on one page something like: <a href"/cgi-bin/downloads.cgi?file=test.r"> and in the downloads.cgi rebol script (after extracting the cgi data), do: print read/binary file-to-xfer ------------------------------------- specific questions include: Q1: how do I initiate a binary xfer in cgi/html, so that instead of displaying binary data as a lump of text in the browser, I get a file transfer dialog. Q2: how do I make 'print work like a write/binary so that the read data actually stays binary... thanks in advance! -max PS: I'll give you one guess as for what site this is for... ;-) ----------- Steel project coordinator http://www.rebol.it/~steel

 [2/6] from: mario:cassani:rebol:it at: 16-Sep-2003 20:40


Hallo Max, must be short, as usual...
> Q1: how do I initiate a binary xfer in cgi/html, so that instead of > displaying binary data as a lump of text in the browser, I get a file > transfer dialog.
Don't use text/plain as MIME, use some binary ones
> Q2: how do I make 'print work like a write/binary so that the read data > actually stays binary...
Probably you have to 'open and write directly... Anyone can help?
> PS: I'll give you one guess as for what site this is for... ;-)
I guess I will use it for Cinnamon on rebol.it ;'P Zaijian, Mario

 [3/6] from: andrew:martin:colenso:school at: 17-Sep-2003 8:53


max wrote:
> Q1: how do I initiate a binary xfer in cgi/html, so that instead of
displaying binary data as a lump of text in the browser, I get a file transfer dialog.
> Q2: how do I make 'print work like a write/binary so that the read
data actually stays binary... Hi, max! Here's what I use in my Wiki script: 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 ] ] View_File: func [Folder [file!] File [file!]] [ File: any [ if exists? Wiki_Files/:Folder/:File [ Wiki_Files/:Folder/:File ] if exists? Folder/:File [ Folder/:File ] if exists? File [ File ] Rebol/script/header/File ] if not found? find Inline_Extensions extension? File [ print rejoin [ "Content-Disposition: attachment; " {filename="} form last split-path File #"^"" ] ] MIME/Data File ] The key part is this line: write-io system/ports/output Data length? Data And these lines: print [ "Content-Type:" any [ Type? File 'application/octet-stream ] newline ] I hope that helps! 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]

 [4/6] from: g:santilli:tiscalinet:it at: 17-Sep-2003 9:51


Hi Maxim, On Tuesday, September 16, 2003, 7:32:58 PM, you wrote: MOA> Q1: how do I initiate a binary xfer in cgi/html, so MOA> that instead of displaying binary data as a lump of text in MOA> the browser, I get a file transfer dialog. prin "Content-Type: application/octet-stream^M^J^M^J" instead of: prin "Content-Type: text/html^M^J^M^J" MOA> Q2: how do I make 'print work like a write/binary so MOA> that the read data actually stays binary... set-modes system/ports/output [binary: yes] insert system/ports/output read/binary file Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [5/6] from: AJMartin:orcon at: 17-Sep-2003 20:30


Gabriele wrote:
> set-modes system/ports/output [binary: yes] > insert system/ports/output read/binary file
Thanks, Gabriele! I've updated my file script in my Wiki. Andrew J Martin ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/

 [6/6] from: maximo:meteorstudios at: 17-Sep-2003 9:53


thanks to both of you! thats exactly what I needed ;-) -MAx