> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# httpUpload

> Issues an HTTP POST request using multipart/form-data to upload files to an RFC 1867-compliant API endpoint.

Issue an HTTP POST request using multipart/form-data to upload files to an API endpoint compliant with <a href="https://www.rfc-editor.org/rfc/rfc1867" target="_blank">RFC 1867</a>.

## Required Parameters

* **url**: The URL to which the POST request is issued.
* **file:\***: The path to a file to upload. The format of this attribute must include a value after the colon and a value parameter (see the example below).

## Optional Parameters

* **authentication**: Used to set a manually generated authorization header, such as a bearer token.
* **authscheme**: The authorization mechanism to use. Only relevant if user and password are provided. Allowed values are `BASIC`, `DIGEST`, `NONE`, and `NTLM`. The default is `BASIC`.
  * **user**: The username to authenticate with if the authscheme parameter is set to something other than `NONE`.
  * **password**: The password to authenticate with if the authscheme parameter is set to something other than `NONE`.
* **charset**: The charset of the exchanged/transferred data. The default is `UTF-8`.
* **client\_id**: The client Id. Applicable for OAuth 1.0 only.
* **client\_secret**: The client secret. Applicable for OAuth 1.0 only.
* **cookie:\***: Any cookies to add to the request.
* **filename:\***: Used to override the `filename` field of the form data set by the `file` attribute.
* **firewall\_port**: The firewall port number.
* **firewall\_server**: The firewall IP address or host name.
  * **firewall\_user**: The user Id used to authenticate with the firewall.
  * **firewall\_password**: The password used to authenticate with the firewall.
* **firewall\_type**: The firewall type. Allowed values are `NONE`, `TUNNEL`, `SOCKS4`, and `SOCKS5`. The default is `NONE`.
* **followredirects**: Whether or not to follow HTTP redirects. Allowed values are `TRUE` or `FALSE`. The default is `TRUE`.
* **form:\***: Form input variable data to include in the POST.
* **header:name#**: The name for each custom header to pass with the request.
* **header:value#**: The value for each custom header to pass with the request.
* **httpversion**: Version of the HTTP protocol to use. Allowed values are `1.0` or `1.1`. The default is `1.1`.
* **internalconfig#**: Sets an internal configuration setting.
* **name:\***: Used to override the `name` field of the form data set by the `file` attribute.
* **proxy\_authscheme**: The authentication scheme of the proxy server. Allowed values are `BASIC`, `DIGEST`, `PROPRIETARY`, `NONE`, and `NTLM`. The default is `BASIC`.
* **proxy\_authtoken**: The proxy authentication token.
* **proxy\_auto**: Whether or not the proxy should be detected from Windows system settings. This takes precedence over other proxy settings and is not available in Java. Allowed values are `TRUE` or `FALSE`. The default is `FALSE`.
* **proxy\_port**: The port number of the proxy server.
* **proxy\_server**: The IP address or host name of the proxy server used for the request.
  * **proxy\_user**: The user Id used to authenticate with the proxy server.
  * **proxy\_password**: The password used to authenticate with the proxy server.
* **proxy\_ssltype**: The SSL/TLS type of the proxy server. Allowed values are `AUTO`, `ALWAYS`, `NEVER`, and `TUNNEL`. The default is `AUTO`.
* **sign\_method**: The signature method used to calculate the signature for OAuth 1.0. Allowed values are `HMAC-SHA1` and `PLAINTEXT`. The default is `HMAC-SHA1`.
* **sslcert**: The SSL/TLS certificate to be accepted from the server. This can take the form of a full PEM certificate, the path to a file containing the certificate, the public key, the MD5 thumbprint, or the SHA-1 thumbprint. Any certificate other than the one specified is rejected. If unspecified, this value defaults to `TRUSTED`, which means only certificates trusted by the system are accepted. If set to `*`, any certificate is accepted.
* **sslclientcert**: The name of the certificate store for the client certificate.
* **sslclientcertpassword**: The password of the client certificate.
* **sslclientcertsubject**: The subject of the client certificate. Using an asterisk finds the first certificate in the store.
* **sslclientcerttype**: The store type of the client certificate. Allowed values are `USER`, `MACHINE`, `PFXFILE`, `PFXBLOB`, `JKSFILE`, `JKSBLOB`, `PEMKEY\_FILE`, `PEMKEY\_BLOB`, `PUBLIC\_KEY\_FILE`, `PUBLIC\_KEY\_BLOB`, `SSHPUBLIC\_KEY\_BLOB`, `P7BFILE`, `P7BBLOB`, `SSHPUBLIC\_KEY\_FILE`, `PPKFILE`, `PPKBLOB`, `XMLFILE`, and `XMLBLOB`.
* **timeout**: The timeout, in seconds, for the operation to complete. Zero (0) means no timeout. The default is `60`.
* **token**: The request token for OAuth.
* **token\_secret**: The request token secret. Applicable for OAuth 1.0 only.
* **version**: The OAuth version. Use OAuth to authorize the request. Allowed values are `Disabled`, `1.0`, and `2.0`. The default is `Disabled`.

## Output Attributes

* **cookie:\***: The cookies returned with the response.
* **header:\***: The headers returned with the response.
* **http:allcookies**: All of the cookies from the response, returned as a single string.
* **http:content**: The content of the HTTP response.
* **http:statuscode**: The HTTP status code returned from the request.
* **ssl:issuer**: The issuer of the SSL/TLS certificate.
* **ssl:subject**: The subject of the SSL/TLS certificate.

## Example

```xml theme={null}
<!-- Setting the url and upload file for the request -->
<arc:set attr="http.URL" value="https://postman-echo.com/post" />
<arc:set attr="http.file:myfile" value="[FilePath]" />
<!-- Overriding the name and filename attribute on the request -->
<arc:set attr="http.name:myfile" value="myNewFile" />
<arc:set attr="http.filename:myfile" value="customFilename.txt" />
<!-- Setting additional form data on the request -->
<arc:set attr="http.form:hello" value="world" />
<arc:set attr="http.form:foo" value="bar" />
<!-- Adding an HTTP header to the request -->
<arc:set attr="http.header:name#1" value="mySpecialHeader" />
<arc:set attr="http.header:value#1"value="Foo" />
<!-- Setting the credentials via basic authentication -->
<arc:set attr="http.user" value="postman" />
<arc:set attr="http.password" value="password" />
<!-- Optional logging parameter. Useful when troubleshooting a request -->
<arc:set attr="http.logfile" value="/tmp/httpLog.txt" />
<arc:set attr="http.verbosity" value="3" />

<!-- Passing in the http input item to the call and setting the data of the output file to be the HTTP response -->
<arc:call op="httpUpload" in="http" out="response">
  <arc:set attr="output.data" value="[response.http:content]" />
</arc:call>

<!-- Setting the output filename and pushing the file out -->
<arc:set attr="output.filename" value="httpResponseContent.txt" />
<arc:push item="output" />
```
