This topic contains information about POST fields (both standard and custom) which are sent by HTML5/Flash Uploader. Use it when writing the server-side upload processing code. You should extract them in the same manner as if they were sent through the standard HTML form. See Saving Uploaded Files in HTML5/Flash Uploader ASP.NET, Saving Uploaded Files in HTML5/Flash Uploader PHP, and Saving Uploaded Files via HTML5/Flash Uploader in Other Platforms topics for more details on how to work with them.
If you use HTML5/Flash Uploader ASP.NET or HTML5/Flash Uploader PHP you can refer standard fields via the PostFields constants.
The table below contains a list of POST fields that are generated and uploaded by HTML5/Flash Uploader.
Name | Type | Description |
---|---|---|
Upload Information | ||
PackageIndex | Integer |
Zero-based index of the package inside the current upload session. Using this field you can recognize the order of the uploaded files if they were sent in different packages. |
PackageCount | Integer |
A total number of packages in the current upload session. |
PackageGuid | GUID |
Unique identifier of the current upload session. When the upload is separated into several packages, all of them will have the same GUID. You can use it to determine whether files are uploaded in the same session (useful for concurrent uploads from several users) or not. |
PackageFileCount | Integer |
Number of files uploaded in the current package.
Note
HTML5/Flash Uploader sends a one file per package. Therefore, this field is always
|
RequestComplete | Integer |
End of request marker. This field is always |
PackageComplete | Integer |
End of package marker. This field is always |
RequestCount | Integer | Number of requests associated with a package. This field is sent in the end of the package. |
FilenamesUrlEncoded | Boolean | Whether filenames are sent URL-encoded. If yes (i.e.
|
Name | Type | Description |
Original File Information | ||
SourceName_N * | String |
Name of the original Nth file. It is useful to employ this field to get the name of the original file when only a resized copy of an image is uploaded. |
SourceSize_N * | Integer |
Size of the original Nth file in bytes. |
SourceCreatedDateTime_N * | Time |
Creation date of the original Nth file in EXIF-style format:
For example, 28th of March, 2:40PM would be:
|
SourceLastModifiedDateTime_N * | Time |
The last modification date of the original Nth file in EXIF-style format:
For example, 28th of March, 2:40PM would be:
|
SourceCreatedDateTimeLocal_N * | Time |
The local creation date of the original Nth file in EXIF-style format:
For example, 28th of March, 2:40PM would be:
|
SourceLastModifiedDateTimeLocal_N * | Time |
The local last modification date of the original Nth file in EXIF-style format:
For example, 28th of March, 2:40PM would be:
|
SourceWidth_N * | Integer |
Width of the original Nth file in pixels if it is an image. Otherwise, this field contains |
SourceHeight_N * | Integer |
Height of the original Nth file in pixels if it is an image. Otherwise, this field contains |
HorizontalResolution_N * | Integer |
Horizontal resolution of the original Nth file if it is an image (measured in DPI - dots per inches).
Otherwise, this field contains |
VerticalResolution_N * | Integer |
Vertical resolution of the original Nth file if it is an image (measured in DPI - dots per inches).
Otherwise, this field contains |
Name | Type | Description |
Converted File Information | ||
FileX_N ** | File |
The Xth converted file for the Nth user-selected file. |
FileXMode_N ** | String |
The mode of the Xth converted file created for the Nth user-selected file. Possible values are:
|
FileXName_N ** | String |
The name of the Xth converted file created for the Nth user-selected file. Depending on the FileXMode_N field value, this field contains one of the following names:
|
FileXSize_N ** | Integer | Size of the Xth converted file created for the Nth user-selected file (in bytes). |
FileXWidth_N ** | Integer |
Actual width of the Xth converted file created for the Nth uploaded file if it is an image (in pixels).
Otherwise, this field contains Depending on the converter.thumbnailFitMode, this value may differ from the value specified through the converter.thumbnailWidth property. This happens because HTML5/Flash Uploader preserves the aspect ratio of the image and seldom can use the same dimensions as specified in thumbnail parameters. |
FileXHeight_N ** | Integer |
Actual height of the Xth converted file created for the Nth uploaded file if it is an image (in pixels).
Otherwise, this field contains Depending on the converter.thumbnailFitMode, this value may differ from the value specified through the converter.thumbnailHeight property. This happens because HTML5/Flash Uploader preserves the aspect ratio of the image and seldom can use the same dimensions as specified in thumbnail parameters. |
FileXHashCodeMD5_N ** | String |
MD5 hash value of the Xth converted file created for the Nth user-selected file. Calculated only if you use Converter.Hash property. |
FileXChunkIndex_N ** | Integer |
Zero-based index of this chunk of the Xth converted file created for the Nth user-selected file.
Note
This field is sent if UploadSettings.ChunkSize is greater
than |
FileXChunkCount_N ** | Integer |
Number of chunks of the Xth converted file created for the Nth user-selected file.
Note
This field is sent if ChunkSize is greater
than |
Name | Type | Description |
User Input | ||
Angle_N * | Integer |
Rotation angle of Nth user-specified file (measured in degrees clockwise). This field is changed if the user clicks an arrow icon to rotate an image. You can use it if you want to rotate images on the server side (e.g. if you upload only source file). Possible values are:
|
CropBounds_N * | String |
Crop bounds of the Nth user-selected image in the following format: You can use it if you want to crop images on the server side (e.g. if you upload only original file). |
Description_N * | String |
User-provided description of the Nth user-selected file. |
Tag_N * | String | Tag attached to the Nth user-selected file. |
* The N character appended to the field name is a placeholder for an index of this file in the uploaded package. This index is zero-based. For example, HTML5/Flash Uploader sends one file per package, so to retrieve a name of this file use the SourceName_0 field (the same is true for other XXX_N fields). ** HTML5/Flash Uploader can generate up to three converted files per each user-selected file and send them to the server. The X character is a placeholder for an index of the converted file created for the Nth user-selected file. Maximum X value is not bigger than the number of converter instances added to the converters array. For example, if you set two converters, the following fields will be available on the server: File0_0 and File1_0. |
HTML5/Flash Uploader is able to send not only fields described in the table above, but also custom fields. It can be done in two ways:
<form>
element somewhere to your code, add elements to it (<input>
,
<select>
,
<textarea>
elements are supported), and set its name as a value of this property. Then HTML5/Flash Uploader automatically appends data from this <form>
to the request that is sent to the server.Sometimes you may need an additional control over the POST fields sent by the uploader. For example, you already have a server code which expects a particular POST field names, or you don't want the uploader to some fields. For example, if you use it for uploading to CDN or REST API.
To address such issues, you may use JavaScript methods described below. For example, the uploader uses them internally to organize uploads to Amazon S3.
POST fields is not the only way to send something to the server. You can also use HTTP headers. For example, when uploading files to Amazon S3, headers may help to control caching policy, etc.
To set headers, use the metadata.uploadRequestHeaders(Object) like this:
var u = $au.imageUploaderFlash("upldr"); // Use it to add new set of headers (it will replace the previously specified headers) u.metadata().uploadRequestHeaders({ 'X-My-Header-1': 'Value 1', 'X-My-Header-2': 'Value 2' }); // Use it to append another header to the existing headers var h = u.metadata().uploadRequestHeaders(); h['X-My-Header-3'] = 'Value 3'; u.metadata().uploadRequestHeaders(h); // Clear all custom HTTP headers from the list u.metadata().uploadRequestHeaders({});