[Seaside] image or binary in WAFile

Renaud Vilain rvilain at skynet.be
Wed Nov 23 16:07:04 UTC 2011


Thanks Nick,

 

It’s working J

 

Renaud Vilain

 

De : seaside-bounces at lists.squeakfoundation.org
[mailto:seaside-bounces at lists.squeakfoundation.org] De la part de Nick
Ager
Envoyé : dimanche 20 novembre 2011 17:53
À : Seaside - general discussion
Objet : Re: [Seaside] image or binary in WAFile

 

Hi Renaud,

 

At first, I take files with the fileupload function, files could be
txt, jpg, pdf. I receive WAFile  ( perfect, no problem)

In a second time, I’ve got to backup the state of the system using an
xml file. I don’t specially need to export datas, my files could stay
on the server.

My problem is that, later, when I need to import a backup, I’ve got to
rebuild a WAFile for each files.

 

So I would like to create a WAFile from a file who is already on the
server.

 

Try something like (not tested):

 

            FileStream fileNamed: filePath do: [ :stream |

                        stream binary.

 

                        file := WAFile new

                                   contentType:(WAFileLibrary
mimetypeFor: (filename copyAfterLast: $.));

                                   contents: stream contents;

                                   fileName: filename;

                                   yourself ]

                        

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20111123/9a0063cd/attachment.htm


More information about the seaside mailing list