File Upload

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

File Upload

keith1y
I have attempted to use the MAFileUploadComponent slightly more manually
than usual.

e.g.

  getComponent

  ^ widget childrenCache at: {item. field} ifAbsentPut: [
        (field componentClass
                    memento: (MAStraitMemento model: item description:
field)
                    description: field
                    parent: widget).
    ].


However, the value returned to the callback is the filename string,
rather than the file itself. I feel I am missing something somewhere,
any ideas what it might be?

Keith



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Lukas Renggli-2
> However, the value returned to the callback is the filename string,
> rather than the file itself. I feel I am missing something somewhere,
> any ideas what it might be?

Is your form declared as a multipart form? Magritte normally does  
that automatically, but only if it knows that there is a file-upload  
component somewhere.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

keith1y
Lukas Renggli wrote:

>> However, the value returned to the callback is the filename string,
>> rather than the file itself. I feel I am missing something somewhere,
>> any ideas what it might be?
>>    
>
> Is your form declared as a multipart form? Magritte normally does  
> that automatically, but only if it knows that there is a file-upload  
> component somewhere.
>
> Lukas
>  
That will be it, thank you so much.

I do find the whole forms handling in seaside a confusing thing...

I dont see how my inner components are supposed to know whether or not
they are in a form. I am not sure how much seaside does for me in this
respect etc etc...

anyways... thanks again for your help

Keith

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Lukas Renggli-2
> I dont see how my inner components are supposed to know whether or not
> they are in a form. I am not sure how much seaside does for me in this
> respect etc etc...

You can find that out by walking up the stack. Something like this  
should work (but it is not nice):

isWithinForm
     current := thisContext.
     [ current isNil ] whileFalse: [
         current selector = #form
             ifTrue: [ ^ true ].
         current := current sender ].
     ^ false

In Magritte the model tells Seaside if it requires a multipart form  
or not.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki