I'm using this code to include ImageUploader in my PHP application:
$iu = new ImageUploader('ImageUploader1', 500, 300);
$iu->setPaneLayout('TwoPanes');
$iu->setShowDebugWindow(true);
$iu->setAllowRotate(false);
$iu->setLicenseKey('my-licence-code-here');
$iu->setActiveXControlEnabled(false);
$iu->setJavaAppletEnabled(true);
$iu->setAllowAutoRotate(true);
$iu->setAllowFolderUpload(true);
$iu->setDescriptionsReadOnly(true);
$iu->setShowSubfolders(true);
$iu->setBackgroundColor('#FAFAFA');
$iu->setFolderView('List');
$iu->setFilesPerOnePackageCount(1);
$iu->setMaxImageHeight(4000);
$iu->setMaxImageWidth(4000);
$iu->setMinImageWidth(1500);
$iu->setMinImageHeight(1500);
$iu->setFileMask('*.jpg');
$iu->addClientBeforeUpload("beforeUploadHandler");
$iu->setAction('my-URL'));
$iu->setRedirectUrl('index.php');
//Configure installation progress.
$iu->getInstallationProgress()->setVisible(true);
$iu->getInstallationProgress()->setProgressCssClass("ScreenStyle");
$iu->getInstallationProgress()->setInstructionsCssClass("ScreenStyle");
$iu->render();
My need is to not letting the upload start if some rules on filenames match. I wrote the beforeUploadHandler function, but without success, so I went back to the very low level of debug: this is the javascript function:
function beforeUploadHandler() {
alert('running...');
return false;
}
The popup shows correctly when i press "upload" button, but then the upload proceed anyway.
From the documentation:
"A boolean value (true or false). If event handler returns false (or zero), the upload is cancelled. Otherwise, upload begins immediately after the event handler finishes. This makes the event handler convenient for validating additional data provided by user. "
I tried with zero also, with no changes on result. What am I missing?
-f