## Aurigma Image Uploader 7.0.11

# Configuring POST Format

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

Let us assume the situation when you already have a web site and you just want to embed Image Uploader in it. For example, your server-side scripts parse the POST request in a strongly defined format, and of course you do not want to rewrite them to make compatible with Image Uploader. In that case you just need to configure the control to send the POST request in the necessary format.

As you know, Image Uploader sends files and additional data as POST fields. There are two kinds of these fields:

- Standard fields contain all the files and other upload information generated by Image Uploader. Standard fields have a predefined format by default.
- Additional fields are custom. They can be attached to the POST request using the Metadata.AdditionalFormName property or the metadata.addCustomField(String, String, Boolean) method. Additional fields can use any format you like but should not conflict with the standard field names.

See the POST Field Reference topic for more details.

If a predefined format of standard POST fields is inconvenient for you, like in the situation described at the beginning of this article, you can rename them using the renameStandardField(String, String) method. This method uses two string parameters originalName and newName, where originalName is a name of some standard field and newName is its new name. Both parameters can contain particular indices or use the following placeholders:

- [itemIndex] is the current index of the uploaded file.
- [converterIndex] is the current index of the converted file.

The code sample below demonstrates how to rename standard POST fields and attach the additional fields to make Image Uploader compatible with server-side scripts which parse the POST request in the following format:

- Author means author of the uploaded file.
- Number means number of the uploaded file.
- FileN is original file, where N is an index of this file.
- FileN-Description is description of the Nth uploaded file.
- FileN-ThumbnailX is the Xth thumbnail for the Nth uploaded image, or icon for non-image files.
- FileN-ThumbnailX-Size is size of the Xth thumbnail of the Nth uploaded image.
- FileN-ThumbnailX-Width is width of the Xth thumbnail of the Nth uploaded image.
- FileN-ThumbnailX-Height is height of the Xth thumbnail of the Nth uploaded image.

### JavaScript

    var u = $au.uploader({
        id: 'Uploader1',

        converters: [
            { mode: '*.*=SourceFile'},
            { mode: '*.*=Thumbnail;*.*=Icon', thumbnailFitMode: 'Fit', thumbnailWidth: '120', thumbnailHeight: '120' },
            { mode: '*.*=Thumbnail;*.*=Icon', thumbnailFitMode: 'Fit', thumbnailWidth: '640', thumbnailHeight: '480' }
        ],

        //... other parameters ...
    });

    u.metadata().addCustomField("Author", author);
    u.metadata().renameStandardField("PackageFileCount", "Number");
    u.metadata().renameStandardField("File0_[itemIndex]", "File[itemIndex]");
    u.metadata().renameStandardField("Description_[itemIndex]", "File[itemIndex]-Description");
    u.metadata().renameStandardField("File[converterIndex]_[itemIndex]", "File[itemIndex]-Thumbnail[converterIndex]");
    u.metadata().renameStandardField("File[converterIndex]Size_[itemIndex]", "File[itemIndex]-Thumbnail[converterIndex]-Size");
    u.metadata().renameStandardField("File[converterIndex]Width_[itemIndex]", "File[itemIndex]-Thumbnail[converterIndex]-Width");
    u.metadata().renameStandardField("File[converterIndex]Height_[itemIndex]", "File[itemIndex]-Thumbnail[converterIndex]-Height");

    u.writeHtml();

Note

Renamed fields cannot be retrieved using the PostFields constants.

## See Also

### Reference

- Metadata Class
- POST Field Reference

### Manual

- Uploading Additional Data in ASP.NET
- Uploading Additional Data in PHP

- AdditionalFormName (ASP.NET)
- AdditionalFormName (PHP)
- additionalFormName (JavaScript)

- PostFields (ASP.NET)
- PostFields (PHP)

- Metadata (ASP.NET)
- Metadata (PHP)
- metadata (JavaScript)