Problem with upload function in seaside Visualworks 7.8

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

Problem with upload function in seaside Visualworks 7.8

Christophe Allegrini
Hello,

I have a problem with the upload function in seaside, VisualWorks 7.8.

The file upload by the seaside server after write in the default repertory have lock by VisualWorks,
Stop and start seaside server not unlock the file, it is very strange bug.

But in the version 7.6, the file uploaded was never lock.

How correct this bug in seaside/opentalk, please ?

Thanks in advance for your help

code example : (html form)
                multipart;
                with:
                                [html fileUpload callback: [:f | fileUL := f].
                                html submitButton text: 'Load'.
                                (html button)
                                        callback: [self answer];
                                        with: 'Revenir au Détail'].

The file pointed by fileUL is systematicaly locked by Visualworks 7.8, I think it is in Opentalk extension for seaside, but I dont find where, unhappily.

Best Regards,

Christophe Allegrini
Reply | Threaded
Open this post in threaded view
|

Re: Problem with upload function in seaside Visualworks 7.8

Christophe Allegrini
Hello

Finally I found the problem.
Class : SeasideMarshaler
Method : asSeasideFileStream: aMimeEntity

Initial version in Visualworks 7.8 :

        | contentType stream contents |
        aMimeEntity formFilename isEmpty ifTrue: [^nil].
        contentType := String new writeStream.
        aMimeEntity contentTypeField printValueOn: contentType.
        contentType := contentType contents copyWithout: Character cr.

        stream := aMimeEntity body byteSource.
        aMimeEntity isBinary ifFalse: [stream := stream stream].
        contents := stream reset; upToEnd.
        contents changeClassTo: ByteString.

        ^Seaside.WAFile new
                fileName: aMimeEntity formFilename;
                contents: contents;
                contentType: contentType


Version with my correction :
- add ensure: ensure: [stream close]. And add correction for txt file provide in public store by Cincom.
That works fine, the problem was the stream was never closed.

       
        | contentType stream contents |
        aMimeEntity formFilename isEmpty ifTrue: [^nil].
        contentType := String new writeStream.
        aMimeEntity contentTypeField printValueOn: contentType.
        contentType := contentType contents copyWithout: Character cr.
       
        [stream := aMimeEntity isBinary
                                ifTrue: [aMimeEntity body byteSource]
                                ifFalse: [aMimeEntity body anySource].
        contents := stream
                                reset;
                                upToEnd]
                        ensure: [stream close].
        contents changeClassTo: ByteString.
        ^(Seaside.WAFile new)
                fileName: aMimeEntity formFilename;
                contents: contents;
                contentType: contentType


Best Regards, Christophe