How to post a GIF file to an HTTP server

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Thu Jun 8 11:25:02 UTC 2006


Rudolf Coetsee puso en su mail :

> Hi
>  
> I would like to post a GIF file to a server using the "httpPost" method of the
> "HTTPSocket" class in Squeak. Can anyone please send me a code snippet on how
> this works. I think I have to somehow put the contents of the image file into
> the "argsDict" object, but I am not sure whether I should encode the contents
> first or not. If I have to encode it, is there a method I can use already in
> Squeak? 
>  
> Thanks in advance
>  
> RUDOLF COETSEE 
> 
> Rudolf :
See Form asWebImage, could be what you need

asWebImage
    "return a MIMEDocument"
    | aStream |
    aStream := RWBinaryOrTextStream on: ''.
    GIFReadWriter
        putForm: (self asFormOfDepth: 8)
        onStream: aStream.
    aStream reset.
    ^ MIMEDocument contentType: MIMEDocument contentTypeGif content: aStream
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060608/11159818/attachment.htm


More information about the Squeak-dev mailing list