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

Notification

Icon
Error

Options
Go to last post Go to first unread
dreynolds  
#1 Posted : Thursday, August 20, 2009 2:41:46 AM(UTC)
dreynolds

Rank: Newbie

Groups: Member
Joined: 5/26/2008(UTC)
Posts: 7

Hi,

Which parameter is needed to check the lenght of the filename being uploaded. I need to limit this to 80 as this is the size of the column in the DB.

Thanks

dreynolds  
#2 Posted : Thursday, August 20, 2009 3:22:42 AM(UTC)
dreynolds

Rank: Newbie

Groups: Member
Joined: 5/26/2008(UTC)
Posts: 7

We currently have a check on the Before_Upload function but i was looking to validate it before a users gets a change to upload the file. Ive looked through the documentation but cannot seem to find any param for this.

Any help would be greatly appreciated.

* Also how do you mark a post as answered??

Fedor  
#3 Posted : Thursday, August 20, 2009 6:26:55 AM(UTC)
Fedor

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)
Quote:
Which parameter is needed to check the lenght of the filename being uploaded. I need to limit this to 80 as this is the size of the column in the DB.

There is no built-in parameter to check filename length. Even though, you can implement custom restrictions using JavaScript.

Quote:
We currently have a check on the Before_Upload function but i was looking to validate it before a users gets a change to upload the file. Ive looked through the documentation but cannot seem to find any param for this.

You can use ImageUploader.UploadFileCountChange Event instead which is fired when new files are selected to be uploaded.

You can find example in Specifying Restrictions for Image Dimensions -> How to Set Custom Restrictions topic.

Here is a modified code sample to check the length of the file recently added:

Code:
<script language="javascript" src="iuembed.js"></script>

<script language="javascript">
function ImageUploader_UploadFileCountChange() {
    var imageUploader=getImageUploader("ImageUploader");
    for (i=imageUploader.getUploadFileCount(); i >= 1; i--) {
        var fn = new String(imageUploader.getUploadFileName(i));
        if (new String(fn.length > 80) {
            alert(fn + " has length more than 80 characters.");
            imageUploader.UploadFileRemove(i);
        }
    }
}
</script>

//...Any other params and event handlers...

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

//...Any other params and event handlers...

iu.writeHtml();
</script>

Quote:
* Also how do you mark a post as answered??

I am sorry, only administrators have permissions for it.

Best regards,

Fedor Skvortsov

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.