Re: Newbie : Help to include a WOFileUpload as a D2WCustomComponent
Re: Newbie : Help to include a WOFileUpload as a D2WCustomComponent
- Subject: Re: Newbie : Help to include a WOFileUpload as a D2WCustomComponent
- From: Chuck Hill <email@hidden>
- Date: Thu, 17 Aug 2006 14:09:30 -0700
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 = aFileContents;
mimeType = aMimeType;
}
Form1: WOForm {
enctype = "mutlipart/form-data";
}
SubmitButton1: WOSubmitButton {
action = addFile;
value = "Click Here when done";
} _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden