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

Notification

Icon
Error

Options
Go to last post Go to first unread
Fedor  
#1 Posted : Friday, April 07, 2006 12:01:26 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,522

Thanks: 3 times
Was thanked: 52 time(s) in 51 post(s)
Hello, I just wanted to post simple code snippet how to add custom file restriction. For example you can allow to select images with 3:4 aspect ratio only:
Code:
<script language="javascript" src="iuembed.js"></script>

<script language="javascript">
function ImageUploader_UploadFileCountChange(){
	var imageUploader=getImageUploader("ImageUploader");
	for (i=imageUploader.UploadItems.Count; i>=1; i--){
		var uploadItem = imageUploader.UploadItems.Item( i)
		if (uploadItem.Height/uploadItem.Width!=0.75){
			alert(uploadItem.FileName + " doesn't have 3:4 ratio.");
			imageUploader.UploadItems.Remove(i);
		}
	}
} 
</script>

<script language="javascript">
var iu = new ImageUploaderWriter("ImageUploader", 770, 500);


//For ActiveX control we specify full path for CAB file
iu.activeXControlCodeBase = "./ImageUploader3.cab";
iu.activeXControlVersion = "3,5,204,0";

//For Java applet we specify only directory with JAR files
iu.javaAppletCodeBase = "./";
iu.javaAppletCached = true;
iu.javaAppletVersion = "1.1.81.0";

iu.addParam("Layout","TwoPanes");
iu.addParam("Action","Upload.aspx")

iu.addEventListener("UploadFileCountChange", "ImageUploader_UploadFileCountChange");

iu.writeHtml();
</script>

Edited by user Thursday, December 20, 2007 4:50:53 PM(UTC)  | Reason: Not specified

Best regards, Fedor Skvortsov
Users browsing this topic
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.