Giles,

Ok here is what I think your problem is:

WOFileUpload requires the "multipart/form-data" to be bound the the form's encType binding.  Since a D2W Edit page already has it's own form tag there is no way to set that binding (unless you can do it with a D2W rule).  If you add your own <form> tags in the custom upload component it doesn't help because you would end up with a nested form an the outer (D2W) form does not have the encType set.

In order to add the file upload you will likely need to freeze that edit page and add the WOFileUpload that in the frozen page.


On Aug 17, 2006, at 6:24 PM, Gilles MATHURIN wrote:

So if i understand, what you adive me is to not follow the method of the WebObjects D2W Guide regarding the Creating a Custom Property-level Component, but to write my own method (or Component) to store the file in the database ?

It starts being complicated, isn't it ?

Regards.

GM


Le 17 août 06 à 18:06, Chuck Hill a écrit :


On Aug 17, 2006, at 3:00 PM, Gilles MATHURIN wrote:

What do you mean by i don't need to do this…

i try to follow the EditPopUp example from the D2W Guide, with the help of R.Walker for a better understanding of it (thanks again)
and now the D2WApp is blocked…

 a little enlightment ? :-)

I don't see why you need the takeValuesFromRequest method at all.  Take it out.  I also don't see any relation to D2W...

Chuck


Regards.

GM.
Le 17 août 06 à 17:09, Chuck Hill a écrit :


On Aug 17, 2006, at 2:02 PM, Gilles MATHURIN wrote:

Hello all,

I took some vacations on St-Marteen Island, and i am back now, hope you had a great last week.

I think this list has a no gloating rule.  :-P


I see that the discusison on the WOCommunity Topic has been exciting and rich

I'd like to contribute even i don't know how still.

Meanwhile, i need some clue to implement a WOFileUpload as a D2WCustomComponent
I managed to create a partial component and it displays in the D2WApp, but the file i choose is not saved in the database…

Here my files :

===
The CustomComponent : UploadDataPage
===


import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;

public class UploadDataPage extends WOComponent {


protected NSData aFileContents;
protected String aMimeType;
protected String aUrl;


protected EOEnterpriseObject object;
protected String key;

    

    public UploadDataPage(WOContext context) {
        super(context);
    }

    

public void takeValuesFromRequest(WORequest request, WOContext context) {
object.takeValueForKey(aFileContents, key);

Ouch!  (a) You don't need to do this  and (b) if you override methods declared in the frameworks, you should almost always call super:

super.takeValuesFromRequest(request, context);
}


Chuck


public WOComponent addFile() {
object.takeValueForKey(aFileContents, key);
return null;
}

}

===
The Wod File
===

FileUpload1: WOFileUpload {
data = "">
mimeType = aMimeType;
}

Form1: WOForm {
enctype = "mutlipart/form-data";
}

SubmitButton1: WOSubmitButton {
action = "">
value = "Click Here when done";
} _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]


-- 

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    http://www.global-village.net/products/practical_webobjects








-- 

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

--
Robert Walker



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to