image or binary in WAFile

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

image or binary in WAFile

Renaud Vilain

 

Hi Nick,

 

Thank you for your answer.

 

I know thoses links and  they don’t help me.

 

 

So i’m going to explain my project.

 

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.

 

 

Greeting J

 

RenaudVilain

 

>HI Renaud
> 
> 
>>  I’m trying to put an image or a binary file (pdf, doc,..), stored on the
>> server, into a WAFile. Could you help me please
>> 
> 
>Can you be a little more precise about the problem you having.
> 
>Try bringing up references to WAFile (shift+cmd+n) to give you a few
>examples to get you started.
>Perhaps also the file upload example
>http://book.seaside.st/book/fundamentals/forms/fileupload
> 
>Or perhaps file libraries may be of use:
>http://book.seaside.st/book/in-action/serving-files/filelibraries/creating
> 
>HTH
> 
>Nick

 


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: image or binary in WAFile

Nick
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 ]




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: image or binary in WAFile

Renaud Vilain

Thanks Nick,

 

It’s working J

 

Renaud Vilain

 

De : [hidden email] [mailto:[hidden email]] 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 ]

                       

 

 

 


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside