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

Notification

Icon
Error

Options
Go to last post Go to first unread
xt  
#1 Posted : Thursday, May 31, 2012 9:31:04 AM(UTC)
xt

Rank: Newbie

Groups: Member
Joined: 5/31/2012(UTC)
Posts: 1

Hi,
I would like to require a description to be added on all photos uploaded. I am using Image Uploader 7 java.

I tried looking for any option for this and did not find it. I also tried looking for an event I could use, or a way I could cancel a fileupload but I did not find one.

Can anyone think of a way I can accomplish this? If a user tries to upload a file without adding a description, I would like to have a message show up somewhere, preferably under the thumbnail, that a description needs to be added.

Thank you.
p.shirykalova  
#2 Posted : Thursday, May 31, 2012 9:01:21 PM(UTC)
p.shirykalova

Rank: Advanced Member

Groups: Member
Joined: 7/13/2011(UTC)
Posts: 286

Thanks: 6 times
Was thanked: 31 time(s) in 31 post(s)
Hi Kyle,

You should check if your files have descriptions in beforeUpload() event. Please see the code below:
Code:
<script type="text/javascript">
    function onBeforeUpload(){
	var count = $au.uploader('Uploader1').files().count();
	for (var i = 0; i < count; i++)
	{
		if ($au.uploader('Uploader1').files().get(i).description()=="")
		{
			alert("Not all files have descriptions!");
			return false;
		}
	}
	}

var uploader = $au.uploader({
    id: 'Uploader1',
    enableDescriptionEditor: true,
    events: {
	beforeUpload: onBeforeUpload,
    }
});
</script>

beforeUpload event is fired before the upload process starts. It is perfect place to add pre-upload tests. So you get the number of files which are currently in the upload pane. Then you check if each of them has got the description. If no description is set, you notify your users about it and return false as a result value of your function. If onBeforeUpload returns false, the upload process won't be started.
I hope this solution works for you.

Edited by user Thursday, May 31, 2012 9:02:17 PM(UTC)  | Reason: Not specified

Best regards,
Pauline Shirykalova
Aurigma Technical Support
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.