AddFile method

Official Content
This documentation is valid for:

Adds file contents to a data buffer that is going to be sent.

Syntax

&HttpClientOrHttpResponseVbleName.AddFile(Path,[Name])

Where:
&HttpClientOrHttpResponseVbleName
     Variable name based on an HttpClient or an HttpResponse data type.

Path
     String containing the file's path.

Name (Optional)
     String containing the name of the variable with which the server waits for the file.

Scope

Extended data types: HttpClient, HttpResponse data type
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Description

If the content of the HttpClient message is multipart / form-data (given by Content-Type Header), then the AddFile method adds the file as multipart. In this case, the second parameter is needed to indicate the name of the variable that the file represents. Also, you have to necessarily precede your sentence with a header that specifies a specific Content-Type, like this: 

&Httpclient.Addheader("Content-Type", !"multipart/form-data")

Availability

The AddFile method supports a Multipart message, since GeneXus 15 Upgrade 6

See Also

HttpClient data type
HttpResponse data type