Aurigma Image Uploader Flash 7.2.9
Using Host and Upload Domains that Differ from One Another
Usually Adobe Flash Player does not allow an swf application to access data that resides outside the domain where the application is hosted. It means that you usually cannot host Image Uploader Flash in the one domain and upload files to another. However, you can manage this task by implementing cross-domain policy for Flash applications.
To allow Image Uploader Flash to upload files to some target server you should create the cross-domain policy file, named crossdomain.xml, and place it to the root folder of the target server.
Suppose, Image Uploader Flash is hosted in a server1.com server, whereas it requires to upload files to a server2.com server. In this case files should be placed as follows:
| URL | |
|---|---|
| the Flash control | http://server1.com/Scripts/aurigma.imageuploaderflash.swf |
| a page where Image Uploader Flash is hosted | http://server1.com/default.html |
| the cross-domain policy file | http://server2.com/crossdomain.xml |
| an upload script; aimed to save files and/or get additional data | http://server2.com/upload.aspx |
The cross-domain policy file have to be like in the snippet below:
XML
<cross-domain-policy> <site-control permitted-cross-domain-policies="all"/> <allow-access-from domain="server1.com" to-ports="*"/> <allow-http-request-headers-from domain="server1.com" headers="*"/> </cross-domain-policy>
And Image Uploader Flash should be configured like follows:
ASP.NET
<aur:ImageUploaderFlash ID="Uploader1" runat="server" LicenseKey="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX;YYYYY-YYYYY-YYYYY-YYYYY-YYYYY-YYYYYY"> <UploadSettings ActionUrl="http://server2.com/upload.aspx" /> </aur:ImageUploaderFlash>
PHP
<?php
$uploader = new ImageUploaderFlash("Uploader1");
$uploader->setLicenseKey("XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX;YYYYY-YYYYY-YYYYY-YYYYY-YYYYY-YYYYYY");
$uploader->getUploadSettings()->setActionUrl("http://server2.com/upload.php");
$uploader->render();
?>JavaScript
var fu = $au.imageUploaderFlash({
id: 'Uploader1',
licenseKey: "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX;YYYYY-YYYYY-YYYYY-YYYYY-YYYYY-YYYYYY",
uploadSettings: { actionUrl:"http://server2.com/upload.asp" }
});
fu.writeHtml();