How to post a GIF file to an HTTP server

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to post a GIF file to an HTTP server

Rudolf Coetsee
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 


Reply | Threaded
Open this post in threaded view
|

Re: How to post a GIF file to an HTTP server

Edgar J. De Cleene
Re: How to post a GIF file to an HTTP server 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