function ImageUploader_BeforeUpload(){
var imageUploader = getImageUploader("ImageUploader1");
//Rename "SourceFile_N" field to "photo"
//imageUploader.RenameField("SourceFile_[ItemIndex]", "Filedata");
//Rename "ThumbnailX_N" field to "FileN-ThumbnailX"
imageUploader.RenameField("Thumbnail[ThumbnailIndex]_[ItemIndex]", "Filedata");
//Rename "SourceFileSize_N" field to "FileN-Size"
//imageUploader.RenameField("SourceFileSize_[ItemIndex]", "File[ItemIndex]-Size");
//Rename "Description_N" field to "FileN-Description"
imageUploader.RenameField("Description_[ItemIndex]", "caption");
}
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 710, 500);
//Listeners
iu.addEventListener("BeforeUpload", "ImageUploader_BeforeUpload");
//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "/javascripts/ImageUploader6.cab";
iu.activeXControlVersion = "6,0,11,0";
//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletJarFileName = "ImageUploader6.jar";
iu.javaAppletCodeBase = "/javascripts/";
iu.javaAppletCached = true;
iu.javaAppletVersion = "6.0.11.0";
iu.showNonemptyResponse = "off";
//Configure License Keys
iu.addParam("LicenseKey", "REMOVED");
//Configure appearance and behaviour.
iu.addParam("PaneLayout", "ThreePanes");
//iu.addParam("TreePaneWidth", "205");
iu.addParam("ShowButtons", "False");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("ShowDescriptions", "false");
//Configure colors.
iu.addParam("BackgroundColor", "#ffffff");
iu.addParam("SplitterLineColor", "#0066cc");
//Configure border and splitter line style.
iu.addParam("FolderPaneBorderStyle", "None");
iu.addParam("UploadPaneBorderStyle", "None");
iu.addParam("TreePaneBorderStyle", "None");
iu.addParam("SplitterLineStyle", "Dot"); //NOT SUPPORTED IN JAVA
//Configure thumbnail settings.
iu.addParam("AllowRotate", "true");
iu.addParam("UploadSourceFile", "True");
iu.addParam("UploadThumbnail1FitMode", "ActualSize");
//Configure user quota restriction. In real-life application these values should be
//loaded from server.
iu.addParam("MaxFileCount", "40");
iu.addParam("MessageMaxFileCountExceededText", "You can only upload 40 files at a time.");
iu.addParam("MaxTotalFileSize", "10485760");
iu.addParam("MessageMaxTotalFileSizeExceededText", "You can only upload 10mb at a time.");
//Configure upload settings.
iu.addParam("FilesPerOnePackageCount", "1");
iu.addParam("AutoRecoverMaxTriesCount", "10");
iu.addParam("AutoRecoverTimeOut", "10000");
//Configure URL files are uploaded to.
iu.addParam("Action", "<%= album_photos_path(@album) %>");
//Configure URL where to redirect after upload.
iu.addParam("RedirectUrl", "<%= album_photos_path(@album) %>");
//Add event handlers.
iu.addEventListener("UploadFileCountChange", "ImageUploader1_UploadFileCountChange");
iu.addEventListener("ViewChange", "ImageUploader1_ViewChange");
iu.addEventListener("FullPageLoad", "ImageUploader1_FullPageLoad");
//Create installation progress.
var ip = new InstallationProgressExtender(iu);
ip.setProgressImageUrl("/images/iu/InstallationProgress.gif");
ip.setProgressCssClass("ScreenStyle");
ip.setInstructionsCssClass("ScreenStyle");
//Tell Image Uploader writer object to generate all necessary HTML code to embed
//Image Uploader to the page.
iu.writeHtml();
//]]>
Thanks for your help!