WEBOBJECTS
Title: File Upload Example
Entry Number: 2505
Creation Date: February 24, 1997
Last Updated: <<Date June 17, 1997>>
Procedure Valid for Release: WebObjects 3.x
Keywords: WebObjects, file upload
Overview
File upload is an experimental web protocol (RFC 1867) that allows web browsers to upload a file to the server. Integrating this with WebObjects is non-trivial because it involves supporting a new form type.
Procedure
The example project is 2506_File_Upload_Example.compressed.
On mach, simply double-click on this file and the Workspace will unpack it to FileUpload.woa.
On NT, you must rename the file to FileUpload.tar.Z. At the DOS prompt, type:
gunzip FileUpload.tar.Z
tar xvf FileUpload.tar
Notes
you must modify an application's main file to use RequesterApplication. The RequesterApplication uses MultipartRequest to handle its requests
the results of the file upload are stored in FileUpload's bindings filename and fileContents. filename is the name of the file on the client's side. fileContents is an NSData containing the file. To write the data to a file, use [NSData writeToFile:atomically:]. This is what is done in FileUpload.wo's script.
file upload is server independent, but is browser dependent. It has been tested with Netscape and OmniWeb