Aurigma Forums
»
Upload Suite
»
Discussions – ActiveX/Java Uploader
»
Custom File Restriction (Image Dimension Aspect Ratio)
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 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
|
|
|
|
Aurigma Forums
»
Upload Suite
»
Discussions – ActiveX/Java Uploader
»
Custom File Restriction (Image Dimension Aspect Ratio)
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.