Re: Content-type for Binary File

new topic     » goto parent     » topic index » view thread      » older message » newer message

>From: cklester <guest at RapidEuphoria.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: Content-type for Binary File
>Date: Thu, 21 Oct 2004 14:11:01 -0700
>
>posted by: cklester <cklester at yahoo.com>
>
>Kat wrote:
> > On 21 Oct 2004, at 13:33, cklester wrote:
> > > posted by: cklester <cklester at yahoo.com>
> > > How would I transfer a file via HTTP using mic's URLMON?
> > > Right now I can do this:
> > >    if get_file({"library.esp?getlist","library.esp"}) then
> > >       if get_file({"getform.esp?rrc_p-1.dot","rrc_p-1.dot"}) then end 
>if
> > >    end if
> > > get_file takes a URL (which is also the filename) -or- a URL and 
>filename
> > > (like above) and saves the download result into the filename. For the
> > > library.esp?getlist URL above, it works fine. But for the .DOT file 
>(which
> > > is a Microsoft Word template), it cuts out at about 28kb, even though 
>the
> > > file is about 400kb. I'm sure it's because I'm using "Content-type:
> > > text/plain;," but I don't know what to use.
> > Use  *.* , but i don't think that's the problem. Not all servers care 
>about what
> > content type you say you can accept, and if it did care then it wouldn't 
>send
> > you the first 28K of it.
>
>Kat, I tried using *.* as Content-type, but that still only gave me
>27K or so.
>

     Content-Type for Word documents should be "application/msword". But you 
have bigger problems...

>Here's the code on the server that is sending the file... Maybe this needs
>to be modified... (typed in, not copied)...
>
>}}}
<eucode>
>fn = open("c:\\templates\\" & form2send,"rb")
>if fn > 0 then
>    puts(1,"Content-type: *.*;\n\n")
>    part = gets(fn)
>    while not atom(part) do
>       puts(1,part)
>       part = gets(fn)
>    end while
>end if
>
>Now, I know there's a get_bytes(), but that didn't seem to work either.
>But maybe I wasn't using it properly. So, if anybody can help me out,
>thanks in advance! :)
>

     The Euphoria interpreter does not output to stdout in binary. There is 
no built-in method to change this output format. You therefore have no way 
of sending your binary data correctly in standard Euphoria. You might, 
however, be able to use the Windows API's to change the settings, or just 
output the file, as kat suggested.

>-=ck
>"Programming in a state of EUPHORIA."
>http://www.cklester.com/euphoria/
>

~[ WingZone ]~
http://wingzone.tripod.com/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu