Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Bloomtech  
#1 Posted : Thursday, October 15, 2009 11:58:21 PM(UTC)
Bloomtech

Rank: Newbie

Groups: Member
Joined: 9/23/2009(UTC)
Posts: 3

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

Tamila  
#2 Posted : Sunday, October 18, 2009 9:52:16 PM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hello,

We have reproduced your problem and found the reason. To resolve the problem you need to use new iuembed.js script (see attachment). If you still have any problems with it please let me know.

File Attachment(s):
iuembed.zip (12kb) downloaded 12 time(s).
Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!

Bloomtech  
#3 Posted : Monday, October 19, 2009 11:08:05 PM(UTC)
Bloomtech

Rank: Newbie

Groups: Member
Joined: 9/23/2009(UTC)
Posts: 3

Tamila wrote:
Hello,

We have reproduced your problem and found the reason. To resolve the problem you need to use new iuembed.js script (see attachment). If you still have any problems with it please let me know.

Yes, it works. Thanks. I guess you have a new client Angel

Bloomtech  
#4 Posted : Thursday, November 19, 2009 4:52:56 AM(UTC)
Bloomtech

Rank: Newbie

Groups: Member
Joined: 9/23/2009(UTC)
Posts: 3

Actually I still have issues with the beforeUploadHandler() event, after going online.

It seems that all the control I do inside the JS function are simply ignored under some currently ignored conditions: I use the Image Uploader to receive files fro photographers, and I need to verify some constrains before starting the upload. All the test on our local PC have been successfull.

This is my current beforeUploadHandler function:

function beforeUploadHandler() {

var Lmin = 1900;

var Lmax = 4300;

var errMsg='OK';

//getImageUploader("ImageUploader1").setMessageUploadCancelledText('Invio interrortto dall\'utente');

//alert(getImageUploader("ImageUploader1").getUploadFileCount());

for (var i = 1; i <= getImageUploader("ImageUploader1").getUploadFileCount() ; i++) {

var W = getImageUploader("ImageUploader1").getUploadFileWidth(i);

var H = getImageUploader("ImageUploader1").getUploadFileHeight(i);

if (W>H) {var L=W; var C=H;} else {var L=H; var C=W;}

var rapp = roundTo((L/C),2);

var fn = getImageUploader("ImageUploader1").getUploadFileName(i);

fn.replace("/", "\\");

var aPath=fn.split("\\");

//alert(fn+' '+aPath.length);

if ((rapp<1.49 || rapp > 1.51) && (rapp<1.32 || rapp > 1.34)) {

errMsg = 'Errore nel file ' + fn + '\nIl rapporto tra i lati non è 3/2 o 4/3';

}

if (L < Lmin) {

errMsg = 'Errore nel file ' + fn + '\nIl lato lungo è inferiore a ' + Lmin + 'px';

}

if (L > Lmax) {

errMsg = 'Errore nel file ' + fn + '\nIl lato lungo è superiore a ' + Lmax + 'px';

}

if (aPath.length == 1 & fn != '') {

errMsg = 'Il file ' + fn + ' è stato selezionato direttamente.\nPossono essere selezionate solo cartelle';

}

if (aPath.length > 2) {

errMsg = 'Il file ' + fn + ' è incluso in una sottocartella.\nE\' consentito solo un livello di cartelle';

}

}

if (errMsg != 'OK') {

alert('IMPOSSIBILE PROCEDERE CON L\'INVIO\n\n' + errMsg);

return false;

} else {

return true;

}

}

As you can see constrains are on pixel size and sides ratio. I know I could use the PHP lib to check for file sizes, but this is not the issue, since it works on all our PC with Firefox, IE, Safari and Chrome.

I asked last photopher who submitted "wrong" images (skipping the constraint check) what he used for submitting, and he replied he's using XP and IE.

So my guess is that with some JRE version the function is not executed. Could you please check this for me?

I'll force users to upload latest version of JRE, but..

Yours.

Edited by user Thursday, November 19, 2009 5:02:01 AM(UTC)  | Reason: Not specified

Tamila  
#5 Posted : Thursday, November 19, 2009 11:45:38 PM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hi,

I reproduced your problem. If you do not use HTTP-only cookies, the following method helps you to resolve the issue:

Code:
$iu->setPreserveHttpCookies(false);

Note: this method is a workaround. Our developers will fix the issue in future releases.

Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.