PATH |
Most of today's Web browsers permit the attachment of files to a form submission, useful for such tasks as adding a Microsoft Word document to a resume database or storing a photograph of an employee being added to a company directory. WebObjects 4.0 adds the WOFileUpload component to support RFC 1867, which defines a method of submitting form information using "multipart MIME." Previous versions of WebObjects required additional support that is available from the NeXTanswers on-line support system (see NeXTanswer #2505).
The following browsers work with the WebObjects WOFileUpload component:
To add file-upload support, you must have the WOFileUpload component in a WOForm. You must also add an additional binding to the WOForm to specify that the browser should use multipart MIME encoding to submit the form information (which includes the attached files).
The following steps illustrate how to add file upload support to your application. The example uses the Movies EOModel and a Wizard-generated application. You will add the capability to upload the image of the talent to the application. The image is the photo attribute of the TalentPhoto object. The TalentPhoto object is referenced by the photo relationship of the currently selected talent .
To prepare the example, perform the following steps:
To add file upload support, perform the following steps:
Open the "Main.wo" component in WebObjectsBuilder.
In this example, you should upload "GIF" images that are photographs of people. When you click "Save to Database", the file data is committed to the database as a BLOB since the attribute is a NSData object.
22 July 1998. Timothy Joransen. First Draft.
19 November 1998. Clif Liu. Second Draft.