[Seaside] image or binary in WAFile

Nick Ager nick.ager at gmail.com
Sun Nov 20 16:52:47 UTC 2011


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/20111120/49aaf92f/attachment.htm


More information about the seaside mailing list