## Aurigma Image Uploader Flash 1.0

# Configuring Upload Settings

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

Image Uploader Flash is a client-side application which does not save files on server disk itself. It just submits user-selected files to a page specified in its settings and redirects users to another page when the upload completes. The present topic describes how to specify a

- server page Image Uploader Flash uploads files to,
- page to which users are redirected after upload process completed,
- settings of the files being uploaded.

## General Settings

Upload and redirection pages can be set using the upload property of the imageUploaderFlash class. Here the upload page is specified with the actionUrl property, and the redirection page is specified with redirectUrl.

### JavaScript

    var fu = $au.imageUploaderFlash({id: 'Uploader1'});

    fu.upload({
        actionUrl:'upload.aspx',
        redirectUrl:'gallery.aspx'
    });

### ASP.NET

    <aur:ImageUploaderFlash ID="Uploader1" runat="server">
        <UploadSettings ActionUrl="upload.aspx"
                        RedirectUrl="gallery.aspx" />
    </aur:ImageUploaderFlash>

### PHP

    $uploader = new ImageUploaderFlash();

    $uploader->getUploadSettings()->setActionUrl("upload.php");
    $uploader->getUploadSettings()->setRedirectUrl("gallery.php");

The actionUrl property specifies the URL to the page where files are posted. That page should contain the server code which parses the upload request, saves files to the necessary folders on server, and performs any other additional actions. If you want to submit files to the same page where Image Uploader Flash is hosted, specify the dot character (.) as a value of this property.

When users upload files using the standard <input type="file"> element, they expect to be redirected to the page where they have submitted the files. However, Image Uploader Flash works in a different way. The response generated by the page, which is specified with the actionUrl property, is sent back to Image Uploader Flash and not to the browser. As soon as Image Uploader Flash receives this response, the upload is considered to be completed; and the user is redirected to the page specified with the redirectUrl property. If you do not need this redirection, set this property to an empty string.

When specifying these properties, take into account the following cases:

### Using Quotation Marks and Semicolons

URLs can contain semicolon or quotation mark characters (e.g. http://upload.server.com/uploadFile;jsessionid=123?param='value'). If they do, enclose such URLs in single (' ') or double (" ") quotes to avoid parameter parsing errors. Also, quotation marks (both single ' and double ") inside URLs should be escaped with a backslash:

"http://upload.server.com/uploadFile;jsessionid=123?param=\'value\'"

### Using Absolute and Relative URLs

URLs can be both absolute (e.g. "http://domain.com/Gallery/gallery.aspx") and relative to the current page (e.g. "/Gallery/gallery.aspx").

For example, if Image Uploader Flash is inserted into the http://domain.com/ImageUploaderFlash/default.aspx page, the relative URLs specified via the redirectUrl property will correspond to the following locations.

Specified URL | Expected Location
--- | ---
"/Gallery/gallery.aspx" | http://domain.com/Gallery/gallery.aspx
"./Gallery/gallery.aspx" | http://domain.com/ImageUploaderFlash/Gallery/gallery.aspx
"Gallery/gallery.aspx" | http://domain.com/ImageUploaderFlash/Gallery/gallery.aspx
"gallery.aspx" | http://domain.com/ImageUploaderFlash/gallery.aspx

## Converted Files

In terms of Image Uploader Flash, converted file is an original file selected by user for upload or a file generated from the original file: a downsized copy of the original image, an icon associated with or compressed to a ZIP archive original file. Image Uploader Flash is able to upload up to three converted files per one specified for upload by user.

For example, you configure Image Uploader Flash to send an original file, a downsized copy of image (if the original file is an image) or an icon associated with the original file, and a ZIP archive containing the original file. It means that if the user selects two files (a JPEG image and a PDF document) Image Uploader Flash will send six files:

- the JPEG image and the PDF file themselves,
- a resized copy of the image and a PDF icon,
- and two ZIP archives.

The following samples demonstrate this configuration.

### JavaScript

    var fu = $au.imageUploaderFlash({id: 'Uploader1'});

    fu.converters([
        {mode: '*.*=SourceFile'},
        {mode: '*.*=Thumbnail;*.*=Icon', thumbnailFitMode: 'Fit', thumbnailWidth: '120', thumbnailHeight: '120'},
        {mode: '*.*=Zip'}
    ]);

### ASP.NET

    <aur:ImageUploaderFlash ID="Uploader1" runat="server">
        <Converters>
            <aur:Converter Mode="*.*=SourceFile" />
            <aur:Converter Mode="*.*=Thumbnail;*.*=Icon"
                ThumbnailHeight="120"
                ThumbnailWidth="120"
                ThumbnailFitMode="Fit" />
            <aur:Converter Mode="*.*=Zip" />
        </Converters>
    </aur:ImageUploaderFlash>

### PHP

    $uploader = new ImageUploaderFlash();

    $converters = &$uploader->getConverters();
    $converter = new Converter();
    $converter->setMode("*.*=SourceFile");
    $converters[] = $converter;
    $converter = new Converter();
    $converter->setMode("*.*=Thumbnail;*.*=Icon");
    $converter->setThumbnailWidth(120);
    $converter->setThumbnailHeight(120);
    $converter->setThumbnailFitMode("fit");
    $converters[] = $converter;
    $converter = new Converter();
    $converter->setMode("*.*=Zip");
    $converters[] = $converter;

The way you retrieve and save converted files on the server side depends on the platform you use. If it is ASP.NET or PHP, find the detailed instructions in the Saving Uploaded Files in ASP.NET and Saving Uploaded Files in PHP topics, respectively.

Furtheron, we will discuss converter properties in detail.

### Configuring Conversion Mode

The mode is the most prominent property of the converter class. It specifies what will be uploaded for each file selected for upload (i.e. the original file, a downsized copy of the image, an icon, or a ZIP archive). The converter class allows uploading different types of converted files for various types of files selected for upload client-side. For instance, you can initialize converter to send downsized copies of images for JPEG images and original files for the corresponding types of files. It can be done using the aforementioned mode property.

The mode property contains format string consisting of masks=mode pairs separated by a semicolon. Each pair includes a set of file masks separated by commas and a corresponding mode. In general, this string has the following syntax:

mask11,mask12,...=mode1;mask21,mask22,...=mode2;...

Here is the list of supported modes:

- SourceFile means that the selected file will be uploaded from a user's computer without any changes.
- Thumbnail works as follows: if the selected file is an image, it will be resized using the parameters listed below and uploaded as a JPEG file. Otherwise, a converted file will not be sent.
- Icon means that the system icon associated with the selected file will be uploaded.
- Zip means that the selected file will be packed into a ZIP archive and then uploaded.

When Image Uploader Flash prepares the upload request it extracts masks=mode pairs. Image Uploader Flash checks whether the name of the current file fits the file mask specified in the pair. If it fits the current pair, Image Uploader Flash sends item(s) specified in the pair to a server. Otherwise, if no appropriate file mask is found or Image Uploader Flash is unable to create a downsized copy of the image (if mode is specified as Thumbnail and the current file is not an image), Image Uploader Flash checks the next pair in the same manner.

Note

If there is no file mask corresponding to the original file extension or no appropriate mode, then Image Uploader Flash does not send this converted file.

### Uploading Thumbnails

If you specify the mode property to send a thumbnail, you can also set the following thumbnail parameters:

- thumbnailHeight and thumbnailWidth specify the height and width of the thumbnail respectively.

- thumbnailFitMode specifies how the thumbnail is to be resized. The following values are supported:

  - Fit means that the original image should be resized to fit the rectangle specified with the thumbnailHeight and thumbnailWidth properties. Note that the proportions of the original image will be kept.
  - Width means that the original image should be resized to be not wider than the thumbnailWidth value.
  - Height means that the original image should be resized to be not higher than the thumbnailHeight value.
- thumbnailBgColor specifies the background color of the thumbnail. This color is used when the thumbnail is created for an image with transparency.
- thumbnailJpegQuality specifies a JPEG quality value for the thumbnail. This is a number in the [0, 100] range. If you specify 0, the file size will be extremely small, but the quality will be very low (almost always unacceptable). Alternatively, if you specify 100, the file size will be quite large, but JPEG artifacts will be almost invisible.

## See Also

### Reference

- upload Class
- converter Class

### Manual

- Saving Uploaded Files in ASP.NET
- Saving Uploaded Files in PHP

- UploadSettings (ASP.NET)
- UploadSettings (PHP)
- upload (Java Script)

- ImageUploaderFlash (ASP.NET)
- ImageUploaderFlash (PHP)
- imageUploaderFlash (Java Script)

- ActionUrl (ASP.NET)
- ActionUrl (PHP)
- actionUrl (Java Script)

- RedirectUrl (ASP.NET)
- RedirectUrl (PHP)
- redirectUrl (Java Script)

- ActionUrl (ASP.NET)
- ActionUrl (PHP)
- actionUrl (Java Script)

- ActionUrl (ASP.NET)
- ActionUrl (PHP)
- actionUrl (Java Script)

- RedirectUrl (ASP.NET)
- RedirectUrl (PHP)
- redirectUrl (Java Script)

- RedirectUrl (ASP.NET)
- RedirectUrl (PHP)
- redirectUrl (Java Script)

- Converter (ASP.NET)
- Converter (PHP)
- converter (Java Script)

- Mode (ASP.NET)
- Mode (PHP)
- mode (Java Script)

- Converter (ASP.NET)
- Converter (PHP)
- converter (Java Script)

- Converter (ASP.NET)
- Converter (PHP)
- converter (Java Script)

- Converter (ASP.NET)
- Converter (PHP)
- converter (Java Script)

- Mode (ASP.NET)
- Mode (PHP)
- mode (Java Script)

- Mode (ASP.NET)
- Mode (PHP)
- mode (Java Script)

- Mode (ASP.NET)
- Mode (PHP)
- mode (Java Script)

- ThumbnailHeight (ASP.NET)
- ThumbnailHeight (PHP)
- thumbnailHeight (Java Script)

- ThumbnailWidth (ASP.NET)
- ThumbnailWidth (PHP)
- thumbnailWidth (Java Script)

- ThumbnailFitMode (ASP.NET)
- ThumbnailFitMode (PHP)
- thumbnailFitMode (Java Script)

- ThumbnailHeight (ASP.NET)
- ThumbnailHeight (PHP)
- thumbnailHeight (Java Script)

- ThumbnailWidth (ASP.NET)
- ThumbnailWidth (PHP)
- thumbnailWidth (Java Script)

- ThumbnailWidth (ASP.NET)
- ThumbnailWidth (PHP)
- thumbnailWidth (Java Script)

- ThumbnailHeight (ASP.NET)
- ThumbnailHeight (PHP)
- thumbnailHeight (Java Script)

- ThumbnailBgColor (ASP.NET)
- ThumbnailBgColor (PHP)
- thumbnailBgColor (Java Script)

- ThumbnailJpegQuality (ASP.NET)
- ThumbnailJpegQuality (PHP)
- thumbnailJpegQuality (Java Script)

- UploadSettings (ASP.NET)
- UploadSettings (PHP)
- upload (Java Script)

- Converter (ASP.NET)
- Converter (PHP)
- converter (Java Script)