Back to product page

AddFile method


Adds new file item to the collection.

Type

None

Syntax

  • Basic
object.AddFile Name, Filename, [ContentType]
The AddFile(object,Name,Filename,ContentType) syntax has these parts:
objectAn expression evaluating to an object of type HttpRequestFormUpload.
NameRequired. A String value. Name of the part in the multipart request.
FilenameRequired. A String value. Full path to filename that will be opened, and its contents are pasted into the request.
ContentTypeOptional. A Variant value. String expression as content-type to be specified for this part.

Remarks

AddFile will add file from your local disk and make separate part for multi-part request (for form-based upload). Typically, you will use it when you need to upload files to the server. Instead of specifying filename of your files in Request.Filename property and then issuing POST (or even PUT), you should do it using AddFile method.

Contents of the file will be pasted into the request using special structure, so that script on the server you're accessing with URL property can properly parse the request, and take this file out of the request.

To see sample of this looks in the real life, you can click here.

You can specify content-type argument if you know type of the file you're uploading. If not specified, wodHttpDLX will put 'application/octet-stream' as default, which represent binary files.

Platforms

Windows