## Aurigma Image Uploader 7.0.35

# metadata.addCookie(String) Method

- Collapse All Sections
- See Also
- Language Filter ( all languages )
- Supported browsers:

Adds the specified cookie to the upload request.

## Syntax

### JavaScript

    $au.uploader('uploaderID').metadata().addCookie(cookie);

### Parameters

cookie

  Type: String

  The cookie string to attach it to the upload request.

## Remarks

This method is obsolete. Use the cookie property instead.

Most browsers, such as Firefox since version 2.0.0.5 support HTTP-only cookies. They make it impossible to read these cookies using JavaScript. It increases security and prevents your site from cross-site scripting attacks.

When Image Uploader prepares the POST request before uploading it to the server, it extracts all cookies downloaded along with the page that hosts Image Uploader. To get cookie, Image Uploader uses the same object model as you do in JavaScript (as if you use document.cookie). However, the browser does not allow Image Uploader to get HTTP-only cookies. That is why when you post files to the server, it does not get such cookies.

Note

Image Uploader ASP.NET and Image Uploader PHP automatically pass the session and authentication information to the upload request.

However, if Image Uploader JavaScript is used, you should add cookies to the upload request manually. To do this, add each cookie you need to preserve via this method as it is shown below.

## See Also

### Reference

- cookie Property

### Manual

- Maintaining Sessions and Authentication in ASP.NET
- Maintaining Sessions and Authentication in PHP