FileUploadclass | tadsnet.t[292] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
When your program is acting as a network server, a FileUpload object represents a file received from the client. For example, HTTPRequest.getFormFields() returns a FileUpload object to represent each <INPUT TYPE=FILE> field in the posted form.
When your program acts as a network client (via sendNetRequest), you can create use FileUpload to post file attachments to posted forms.
class
FileUpload : object
contentType | tadsnet.t[335] |
It's important to recognize that this information is supplied by the client, and is NOT validated by the protocol server. At best you should consider it a suggestion, and at worst a malicious lie. The client could be innocently mistaken about the type, or could even be intentionally misrepresenting it. You should always validate the actual contents, rather than relying on the client's description of the format; in particular, be careful not to assume that expected data fields are present, in the valid range, etc.
file | tadsnet.t[318] |
When you create the FileUpload object for use with sendNetRequest() to post form data, you must use a string or ByteArray value for this property.
When the FileUpload is created by HTTPRequest.getFormFields(), this property contains a File object with the uploaded content. This is open for read-only access. If the contentType parameter is a text type ("text/html", "text/plain", etc), and the interpreter recognizes the character set parameter in the contentType, the file is in Text mode (FileModeText) with the appropriate character mapper in effect. Otherwise, the file is in raw binary mode (FileModeRaw). If you need the file to be opened in a different mode, you can use setFileMode() on the file to change the mode.
filename | tadsnet.t[352] |
The client won't necessarily specify a filename at all, in which case this will be nil.
construct (file, contentType, filename) | tadsnet.t[293] |