Rank: Member
Groups: Member
Joined: 9/10/2007(UTC) Posts: 8
|
I searched this forum for any posts that might have already answered my question, but was unable to find anything. Basically, when I click 'Select All' button (by either the default - iu.addParam("CheckFilesBySelectAllButton", "false"); - , or it set to true), it does not fire the function I have tied to the 'UploadFileCountChange' event. The 'Deselect All' button works fine for some strange reason though. Does anyone have any idea why this is happening. Here is some of my code. Thank you, Jason Code: <script type="text/javascript" language="JavaScript">
//This UploadFileCountChange event handler displays total size of all files selected for upload.
function UploadFileSizeChange() {
var imageUploader1 = getImageUploader("ImageUploader1");
if (imageUploader1) {
var nbr = Math.ceil(imageUploader1.getTotalFileSize() / 1024);
var nbrFmt = new NumberFormat(nbr);
nbrFmt.setPlaces(0);
nbrFmt.setSeparators(true);
nbr = nbrFmt.toFormatted();
document.getElementById("TotalSourceFileSize").value = nbr;
document.getElementById("total_size").innerHTML = nbr + ' kb';
UpdateCheckedItemAppearance();
}
}
function UpdateItemAppearance() {
var imageUploader = getImageUploader("ImageUploader1");
var cnt = imageUploader.getPaneItemCount("FolderPane");
//Iterate through all items on the folder pane to check if the item satisfies your upload restrictions
for (var i = 1; i <= cnt; i++) {
if (imageUploader.getPaneItemCanBeUploaded(i) == false) {
//If it does not, highlight it with red
imageUploader.setPaneItemDesign("FolderPane", i, "ForegroundColor=red;" +
"ForegroundOpacity=30;BorderLineStyleLeft=Dot;BorderLineStyleRight=Dot;" +
"BorderLineStyleTop=Dot;BorderLineStyleBottom=Dot;BorderLineColorLeft=red;" +
"BorderLineColorRight=red;BorderLineColorTop=red;BorderLineColorBottom=red");
}
}
}
function UpdateCheckedItemAppearance() {
var imageUploader = getImageUploader("ImageUploader1");
var cnt = imageUploader.getPaneItemCount("FolderPane");
//Iterate through all items on the folder pane and check if the item is going to be uploaded
for (var i = 1; i <= cnt; i++) {
if (imageUploader.getPaneItemChecked(i) == true) {
//If it is, highlight it with green
imageUploader.setPaneItemDesign("FolderPane", i, "ForegroundColor=green;" +
"ForegroundOpacity=30;BorderLineStyleLeft=Solid;BorderLineStyleRight=Solid;" +
"BorderLineStyleTop=Solid;BorderLineStyleBottom=Solid;BorderLineColorLeft=green;" +
"BorderLineColorRight=green;BorderLineColorTop=green;BorderLineColorBottom=green");
} else if (imageUploader.getPaneItemChecked(i) == false && imageUploader.getPaneItemCanBeUploaded(i) == true) {
imageUploader.setPaneItemDesign("FolderPane", i, "ForegroundColor=white;" +
"ForegroundOpacity=00;BorderLineStyleLeft=Solid;BorderLineStyleRight=Solid;" +
"BorderLineStyleTop=Solid;BorderLineStyleBottom=Solid;BorderLineColorLeft=white;" +
"BorderLineColorRight=white;BorderLineColorTop=white;BorderLineColorBottom=white");
}
}
}
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 600, 400);
//Change the default ButtonSendText Property
iu.addParam("ButtonSendText", "Next");
//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "ImageUploader4.cab";
iu.activeXControlVersion = "4,5,4,0";
iu.activeXControlEnabled = false;
//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletCodeBase = "/somedir/util/";
iu.javaAppletCached = true;
iu.javaAppletVersion = "2.5.4.0";
iu.addParam("LicenseKey", "like i would post that!");
iu.showNonemptyResponse = "off";
iu.addParam("CheckFilesBySelectAllButton", "true");
iu.addParam("AutoRecoverMaxTriesCount", "3");
iu.addParam("AutoRecoverTimeOut", "5000");
//Configure appearance and behaviour.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("ShowDescriptions", "true");
iu.addParam("DescriptionsReadOnly", "true");
iu.addParam("BackgroundColor", "#ffffff");
//Configure Image Uploader to rotate photos automatically
//according to the orientation stored in EXIF metadata.
iu.addParam("AllowAutoRotate", "true");
//Append the form with total file size to the upload.
iu.addParam("AdditionalFormName", "Form1");
//Configure file mask to upload JPEG images only.
iu.addParam("FileMask", "*.jpeg;*.jpg;*.jpe;*.pdf;*.doc;*.tif;*.tiff;*.gif;*.txt");
//Set restrictions
iu.addParam("MaxFileSize", "5242880");
//Set image size restrictions.
iu.addParam("MinImageWidth", "0");
iu.addParam("MinImageHeight", "0");
//Exclude the source file from upload because only
//resized versions of the photo will be sent.
iu.addParam("UploadSourceFile", "false");
//Configure settings of the optimized image. Optimized image
//is resized to 1200x1200 with JPEG quality = 60 and EXIF
//metadata is preserved.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "1280");
iu.addParam("UploadThumbnail1Height", "1280");
iu.addParam("UploadThumbnail1JpegQuality", "60");
iu.addParam("uploadThumbnail1FallbackMode", "SourceFile");
iu.addParam("UploadThumbnail1CopyExif", "true");
//Configure thumbnail settings.
iu.addParam("UploadThumbnail2FitMode", "Fit");
iu.addParam("UploadThumbnail2Width", "320");
iu.addParam("UploadThumbnail2Height", "320");
iu.addParam("UploadThumbnail2JpegQuality", "60");
//Configure URL files are uploaded to.
iu.addParam("Action", "../..<%= ContextPath %>/FileUpload");
// iu.addParam("Action", "upload.jsp");
iu.addParam("RedirectUrl", "some.jsp");
iu.addParam("MessageUploadCompleteText", "Your files have been uploaded. Click 'OK' to continue to step 2.");
//Add event handlers.
iu.fullPageLoadListenerName = "UpdateItemAppearance";
iu.addEventListener("FolderChange", "UpdateItemAppearance");
iu.addEventListener("UploadFileCountChange", "UploadFileSizeChange");
//This Progress event handler demonstrates an alternative way to
//redirect upon upload (instead of RedirectUrl property).
function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText) {
if (Status == "COMPLETE") {
window.location = 'some.jsp';
}
}
Edited by user Tuesday, February 12, 2008 12:55:27 PM(UTC)
| Reason: Not specified
|